haXeの新機能

http://lists.motion-twin.com/pipermail/haxe/2009-May/025528.html

This has been successfully implemented on CVS, with a new "using" keyword :

using StringTools;
class Test {
static function main() {
trace( "hello".trim() );
}
}

Completion is also available so it works very nicely.

Please note that only the first method which can be applied to the given
type is selected so overriding depending on arguments types through
multiple-using is not yet available but might be feasible soon.

Nicolas

前から議論されていた、クラスの拡張機能が追加されるようだ。using宣言を書いておくと

StringTools.trim("hello   ")

と書いていた所を

"hello   ".trim()

と書けるようになる。
http://www.scwn.net/2009/05/injecting-methods-into-haxe-classes-with-using/

The other nice thing about this approach is that it works with the more broadly defined Types/typedefs, and not just Classes.

クラス以外の型でも使える。