jsx / JSX

JSX - a faster, safer, easier JavaScript
http://jsx.github.io/
MIT License
1.46k stars 102 forks source link

enumerated type(enum) #218

Open nyuichi opened 11 years ago

nyuichi commented 11 years ago

enum type. I don't think there must or should be enum in JSX, but I'm sure that it would be somehow useful.

enum E {
  X,
  Y,
  Z
}
gfx commented 11 years ago

I believe it is useful, but how about the details? C's enum (just syntactic sugar to integers) is really poor and hard to debug, while Haxe's enum is powerful and effective. I prefer Haxe's, or at least it should be Object type, not numbers.

nyuichi commented 11 years ago

@gfx What do you mean by Hexe's enum? I guess Java's way is good enough for JSX. If you want something that contains data with strongly typed accessors, this pull-req is not what you're discussing. You probably should better open another new pull-req.

kazuho commented 11 years ago

We would need a enum that can be mapped to integers for performance reasons. IMO we might extend that enum to support Haxe-like features in the future, if it seems necessary.