Open utterances-bot opened 2 years ago
What happens if the variable I'm using the extension on is null?
final x: Dynamic = null;
x.anExtensionMethod();
That depends on how the extension method's implementation handles null.
Why using Main.IntExtender
instead of using IntExtender
? IntExtender
itself is not inside of the Main
class.
using x.Y.Z
means using
package x
, module Y
, type Z
, and not class Y
.
IntExtender
is inside module Main
.
IntExtender
itself is not inside of theMain
class.
This wouldn't make any sense anyway since Haxe doesn't allow defining types inside classes.
using x.Y.Z
means using packagex
, moduleY
, typeZ
, and not classY
.IntExtender
is inside module Main.
Oh, that makes sense. And, I guess, just using IntExtender
doesn't compile, even if called from the same module...
This wouldn't make any sense anyway since Haxe doesn't allow defining types inside classes.
Interesting, the manual doesn't seem to mention that anywhere, so I haven't even checked. But that's good - simpler language = less headache.
Thanks for clarifying!
Static Extension (Language Features) - Haxe - The Cross-platform Toolkit
Haxe is an open source toolkit based on a modern, high level, strictly typed programming language.
https://haxe.org/manual/lf-static-extension.html