Closed nadako closed 4 years ago
Cool, thanks ;)
I wonder though if this kind of "optimization" isn't the compiler's job ^^
Yeah, I already created some issues specifically while experimenting with Futures, e.g. this one seems related: https://github.com/HaxeFoundation/haxe/issues/9268
Well, yeah, but the other one is quite tricky.
My point is that $bind
on dynamic
functions seems stupid. In the rare cases where the default implementation needs access to this, the compiler should deal with it, e.g. by emitting this.method = $bind(this, this.method)
in the constructor. Other than that, it should always be plain field access.
this.method = $bind(this, this.method)
That is a good point actually, I'll make a haxe issue about this :)
the difference is that dynamic function is
$bind
-ed indrain
, while a functional field isn't and since we don't need binding we can save a couple ticks