enum fields?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

enum fields?

Raoul Duke
hi,

if an enum has constructor args, can i get at them with dot notation?
i can't get that to work. do i have to use pattern matching
switch-case?

tx.

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: enum fields?

Raoul Duke
i guess not because generally you don't know what variables there are.
in my case, all the enum instances have the same constructor
arguments, tho. oh well. hrm.

On Wed, Mar 23, 2011 at 6:54 PM, Raoul Duke <[hidden email]> wrote:
> hi,
>
> if an enum has constructor args, can i get at them with dot notation?
> i can't get that to work. do i have to use pattern matching
> switch-case?
>
> tx.
>

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: enum fields?

Franco Ponticelli
You can use reflection to get your arguments but the usual way is using switch/case since reflection is untyped and potentially risky.

Franco

On Thu, Mar 24, 2011 at 1:55 AM, Raoul Duke <[hidden email]> wrote:
i guess not because generally you don't know what variables there are.
in my case, all the enum instances have the same constructor
arguments, tho. oh well. hrm.

On Wed, Mar 23, 2011 at 6:54 PM, Raoul Duke <[hidden email]> wrote:
> hi,
>
> if an enum has constructor args, can i get at them with dot notation?
> i can't get that to work. do i have to use pattern matching
> switch-case?
>
> tx.
>

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org