-
-
Notifications
You must be signed in to change notification settings - Fork 662
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
Mark native properties (typed as plain fields) as having side-effectful reads. #8226
Comments
Is this a matter of adding Either way, we should address this for 4.0 because it has the potential to cause regressions. |
Well, it seems like the compiler is very unimpressed with |
Is it only applicable to extern classes? Is possible to somehow define such properties in non-extern classes? |
I mean you can of course hack in some craziness, but in general Haxe fields are just fields :) |
Well, I do actually have a use case for non-extern classes, but today I don't feel like reopening the old debates on what you should and shouldn't do with properties ;) My primary concern is that idiomatic code for DOM APIs has its behavior broken through optimization. People can of course just learn that, but if removing this hurdle is easy enough, I would much prefer to just do it. |
Yeah I agree about DOM stuff and I can imagine some interesting use-cases with actual Haxe properties, but I was talking about plain Haxe non-extern fields. |
On platforms that support native properties, getters may cause side effects, but because we type it as
default
access, the compiler may choose to eliminate them.The most prominent case I can think of is the DOM API, where it's common practice to query layout properties to cause a DOM reflow. I would suggested
@:pure(false)
to be in line with methods, but anything else will do just fine ;)The text was updated successfully, but these errors were encountered: