This project is read-only.

Suggestion for enums

Topics: Language Specification
Nov 17, 2012 at 4:01 PM
Edited Nov 17, 2012 at 4:02 PM

It would be great if enums still acted as numbers for arithmetic and bitwise operators, but could also be toString'ed correctly.

That could be done by creating a class for an enum, and overriding valueOf and toString.

Also the name of an enum should be possible to use as a converter function from number to the enum (similar to Number("12")).


Creating classes for enums might sound non-performant, but actually there could only be a small number of values per enum.

Nov 20, 2012 at 4:15 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.