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

AST annotations #64

Merged
merged 3 commits into from
Nov 28, 2016
Merged

AST annotations #64

merged 3 commits into from
Nov 28, 2016

Conversation

Praetonus
Copy link
Member

@jemc
Copy link
Member

jemc commented Nov 1, 2016

Can you further specify the new syntax allowed within the \ brackets?

For example, can the annotation list span multiple lines? What is the form of each annotation? What characters are allowed? Can they start with a digit?

@jemc
Copy link
Member

jemc commented Nov 1, 2016

If we use the \ character, will we regret it if/when we want to allow use of \ for line continuation (I'm thinking C-style adjacent-line string literals at the moment).

@Praetonus
Copy link
Member Author

Can you further specify the new syntax allowed within the \ brackets?

Yes, I'll detail what identifiers can be (it's meant to be the same as Pony identifiers).

If we use the \ character, will we regret it if/when we want to allow use of \ for line continuation (I'm thinking C-style adjacent-line string literals at the moment).

I'm not sure. Maybe we'd be able to do some parsing tricks. I'd be happy to use something else but there are not many available symbols left and existing symbols would be ambiguous, unless there is something that can only occur in the middle of a grammar rule, but I don't think there is.

Clarify what is a valid annotation name.
@Praetonus
Copy link
Member Author

Going into final comment period.

@Praetonus Praetonus added the status - final comment period The RFC is finalized. Waiting for final comments. label Nov 12, 2016
@SeanTAllen
Copy link
Member

All the examples are single word.

What's the reason for allowing more than a single word in annotations?

Thought: aren't docstrings a sort of annotation?

@Praetonus
Copy link
Member Author

What's the reason for allowing more than a single word in annotations?

The main reason is flexibility. As we add annotations, it will probably make sense to allow different and unrelated annotations on the same language construct, to avoid mutual exclusion of unrelated things.

Thought: aren't docstrings a sort of annotation?

I'd say docstrings are annotations for the programmer (as documentation), and the annotations of this RFC are annotations for tools (either the compiler or third-party tools). Since the latter can affect the final generated code, I don't think it would be good to use the same syntax for both.

@Praetonus Praetonus added status - ready for vote The RFC is ready to be voted on. and removed status - final comment period The RFC is finalized. Waiting for final comments. labels Nov 21, 2016
@Praetonus
Copy link
Member Author

Praetonus commented Nov 23, 2016

We discussed this on the sync meeting. There are some caveats with the proposal and the LL(1) grammar of the language. This wouldn't be problematic for the parser implementation in the compiler but it could make parsing for third-party tools more complex. We decided to accept a modified version of the proposal, by allowing annotations only after keywords. This is sufficient for the compiler annotations we want to add and it can be revised if somebody comes up with something that isn't possible with that scheme.

I'll amend the RFC and merge it.

Restrict the locations allowed for annotations to scoping keywords only.
@Praetonus
Copy link
Member Author

Amended.

@sylvanc @jemc @SeanTAllen If it looks good to you, I'll go ahead and merge.

@sylvanc
Copy link
Contributor

sylvanc commented Nov 24, 2016

Looks good!

@Praetonus Praetonus merged commit 3efb04a into ponylang:master Nov 28, 2016
@Praetonus Praetonus deleted the annotations branch November 28, 2016 13:47
@Praetonus Praetonus removed the status - ready for vote The RFC is ready to be voted on. label Nov 28, 2016
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.

None yet

4 participants