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

Local Variable Metadata #74

Merged
merged 3 commits into from
Jun 19, 2020
Merged

Local Variable Metadata #74

merged 3 commits into from
Jun 19, 2020

Conversation

Antriel
Copy link
Contributor

@Antriel Antriel commented May 26, 2020

Add new syntax for metadata on local variables: var @:meta foo:Bar;.

Rendered Version

@Simn
Copy link
Member

Simn commented May 26, 2020

I'm in favor of this, but at least two things still need clarification:

  • Please mention that this also works with the comma syntax, i.e. var @:meta x, @:meta y
  • Please draw a comparison to metadata function arguments, which should offset the "different from class fields" point.
@Antriel
Copy link
Contributor Author

Antriel commented May 26, 2020

First point added, not sure what exactly you mean by the second one. What are metadata function arguments?
Do you mean an example comparing the currently available solution (moving the metadata up to method level) to how it could look like with the new syntax? I don't see how that offsets the "different from class fields" point.

@Simn
Copy link
Member

Simn commented May 26, 2020

I mean that function test(@:meta x) {} is already valid syntax and aligns nicely with this proposal.

@Antriel
Copy link
Contributor Author

Antriel commented May 26, 2020

Added. I didn't even know about that one (or forgot, regardless, I didn't find it in the manual). :)

@skial skial mentioned this pull request May 26, 2020
1 task
@haxiomic
Copy link
Member

Maybe it would make sense for the alternative syntax to also work (@:meta var foo: Bar), because I think that's the one users will likely try first when they add meta to variables

@Antriel
Copy link
Contributor Author

Antriel commented May 26, 2020

I agree. I like that solution more.
As I outlined, maybe it could be implemented by duplicating the metadata of var declaration expression into the var itself. I am not sure how difficult, if even possible, it is. I'm also not sure what consequences it might have to existing code (I can't think of any though).

@Simn
Copy link
Member

Simn commented May 26, 2020

No, we won't change it like that. It's expression metadata and shouldn't become a special case for local variables. It also doesn't play well with comma syntax.

@haxiomic
Copy link
Member

haxiomic commented May 26, 2020

Ahh agreed, I misunderstood the proposal initially

@Simn
Copy link
Member

Simn commented Jun 19, 2020

We have decided to accept this proposal in our haxe-evolution meeting yesterday.

There's not much to say about this one. Progress will be tracked in the linked Haxe issue.

@Simn Simn merged commit 1abf6b6 into HaxeFoundation:master Jun 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 participants