[haXe] Re: Feature Request: macroe'd Std lib

Nicolas Cannasse ncannasse at motion-twin.com
Wed Oct 27 10:54:59 CEST 2010


Le 26/10/2010 22:19, Cauê Waneck a écrit :
> oh by the way, I could code this for the std lib if the devs would be
> interested to include it.

You're welcome to create your own MacroMath class and share it with the 
community, but I'm not planning to apply such optimizations by default.

A few reasons :

a) macros are not very fast to execute, and processing a lot of such 
calls would slowdown compilation

b) float operations should be done as much as possible on the target 
platform, to prevent inconsistencies between different implementations 
of the same primitives.

c) the semantics of Std.is is about the runtime value, not the 
compile-time type, so it's quite hard for a macro to eliminate this test 
(unless Std.is(new X(),X) for instance)

c) in general, unless it is guaranteed to provide exactly the same 
results (for instance inline functions) I prefer to favor simplicity 
over too many optimizations.

Best,
Nicolas



More information about the Haxe mailing list