-
-
Notifications
You must be signed in to change notification settings - Fork 648
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
Allow arbitrary expressions in place of property identifiers #7129
Conversation
Hmm. My long standing hopes for |
I once mentioned that it would be a good idea for macro-powered sugar, but nowadays I'm not sure how well will it play. For example one usage idea for this would be something like |
I wanted to go for |
I'd prefer that property syntax over the current one, but it raises one question: how would you override accessors now? Would that simply not be supported, or would some I could imagine something like this: // parent type
var prop(() -> _prop, value -> _prop = value):Int;
// child type - only the getter is overriden
override var prop(() -> _prop * 2, super):Int;
|
Since it would still generate |
That doesn't sound very clean to me. I think if a new syntax is introduced, it should properly support all features, not have some strange in-between solution... With the new syntax, the You might be surprised how common overriding accessors is in object-oriented code. A quick Ctrl+Shift+F on flixel shows 47 results for |
I only wanted a short syntax for the current property accessors, but from the comments so far I can already tell that this would have to go through 20 years of haxe-evolution only to then be turned down by Nicolas. |
This change allows parsing any expression where we currently only allow property identifiers. If any non-identifier is used, it fails while loading the type.
This breaks macros that inspect
FProp
, which is unfortunate, but I believe we should break this properly instead of trying to maintain backwards compatibility through some hacks.Obviously, I have a follow-up planned once this is merged.