[haXe] Request for a 'const' modifier

Nicolas Cannasse ncannasse at motion-twin.com
Thu Dec 14 18:21:01 CET 2006


> It would still be nice to have a const statement at complement var :-
>  
>     const x:Array<Float> = [ 1.1323425, 2.567566, ...]
>  
> I am working on a Ephemeris Chart program of about 5500 lines of
> JavaScript converting it to HaXe as JavaScript graphics using div's for
> dots is just too slow.
>  
> There are quite a number of massive arrays, and other places that I
> would like to be constant.
>  
> Ideally 'const' would be a modifier as well as a statement, giving it
> the power it has in C++.

You can trick the content of an array as being readonly by doing the
following :

var x : Array<+Float> = [1,2,3,4];

Nicolas



More information about the Haxe mailing list