Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spec: document string literals #108

Merged
merged 2 commits into from
Sep 25, 2020
Merged

Conversation

laurentlb
Copy link
Contributor

Copied from google/starlark-go#265
I omitted the implementation notes.

Copied from google/starlark-go#265
I omitted the implementation notes.
@laurentlb
Copy link
Contributor Author

Note that it doesn't exactly match the Java implementation, e.g. we reject \a.
I assume you'd rather update the implementation?

def" # "abcdef"
```

An *octal escape* encodes a single byte using its octal value.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(The reference to byte here isn't really appropriate for the Java implementation.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rest of the spec mentions that a "string represents an immutable sequence of bytes."
I think it's correct that an octal escape encodes a byte.

Do you have another phrasing to suggest?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems fine for now. Correctly documenting how the Java implementation differs is a complex and subtle project.

spec.md Outdated
'\119' # "\t9" = "\11" + "9"
```

A *hex escape* encodes a single byte using its hexadecimal value.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(and hex escapes aren't implemented in Java)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing

@alandonovan
Copy link
Contributor

Note that it doesn't exactly match the Java implementation, e.g. we reject \a.
I assume you'd rather update the implementation?

Yes, useless though it may be, every language supports \a thus so should we.

@laurentlb laurentlb merged commit 2b4cb0a into bazelbuild:master Sep 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants