[haXe] Best Practices

Franco Ponticelli franco.ponticelli at gmail.com
Tue Apr 3 18:15:00 CEST 2007


Take a look at the Reflect class in the standard library.
Your will have something like this:
Reflect.callMethod(myClass, 'someMethod', parameters);
Reflect.setField(myClass, 'secondString', someValue);

On 4/3/07, Gerry Fontaine <gnfontaine at gmail.com> wrote:
>
> I am looking for a best practice for creating references to classes and
> or objects.
>
> In the past I used eval('someString') or this['someString']
> The ugly thing about using these methods was that it was not always
> reliable.
> Could anyone recommend a method using haXe which would work reliably
> without using flash.lib.eval
>
> The idea is to dynamically create references to objects and functions
> based on a mixture of  strings and objects
>
> Examples
> eval ( myClass  + 'someMethod' )( parameters );
> eval ( 'firstString' + 'secondString' ).property = someValue;
>
>
>
> --
> haXe - an open source web programming language
> http://haxe.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.motion-twin.com/pipermail/haxe/attachments/20070403/15a6f8f9/attachment.htm


More information about the Haxe mailing list