Closed Antriel closed 4 years ago
I'm in favor of this, but at least two things still need clarification:
var @:meta x, @:meta y
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.
I mean that function test(@:meta x) {}
is already valid syntax and aligns nicely with this proposal.
Added. I didn't even know about that one (or forgot, regardless, I didn't find it in the manual). :)
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
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).
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.
Ahh agreed, I misunderstood the proposal initially
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.
Add new syntax for metadata on local variables:
var @:meta foo:Bar;
.Rendered Version