Repository navigation
Proposal: Declaring an enum restricted by a number,string or boolean set #3105
Description
Activity
- changed the title
[-]Proposal: Declarating a enum restricted by a set of number/numeric literals[/-][+]Proposal: Declarating an enum restricted by a set of number/numeric literals[/+]on May 10, 2015 - changed the title
[-]Proposal: Declarating an enum restricted by a set of number/numeric literals[/-][+]Proposal: Declaring an enum restricted by a set of number/numeric literals[/+]on May 11, 2015 I'm not sure this adds enough value for the complexity it introduces. Are there any other languages that support this kind of feature? It just adds bounds checking to numeric enums but doesn't scale to other enum spaces. We've had requests for string based enums for example which couldn't use this, we use bit flag enums ourselves a lot, and it's not unreasonable to imagine 'illegal' values within a contiguous bound which this wouldn't protect against.
- changed the title
[-]Proposal: Declaring an enum restricted by a set of number/numeric literals[/-][+]Proposal: Declaring an enum restricted by a number,string or boolean set[/+]on May 12, 2015 Dan Quirk (@danquirk) About your mention of other languages, made a weird discovery Pascal has 'set types':
http://en.wikipedia.org/wiki/Pascal_(programming_language)#Set_typesUpdated the proposal with links. This should be super familiar to Anders Hejlsberg (@ahejlsberg) 😮
Dan Quirk (@danquirk)
"a" | "b" | "c"syntax would be insanely helpful for writing.d.tsfiles (lots of JS libraries use magic strings).- addedNeeds ProposalThis issue needs a plan that clarifies the finer details of how it could be implemented.This issue needs a plan that clarifies the finer details of how it could be implemented.
on Dec 9, 2015 Jon (@jbondc) Why the withdrawal? This was a good idea.
Gaelan Steele (@Gaelan) I'm sure the TS team will come up with something. I've left the link to
set types, maybe they will call itcollection typesor something. When philosophies diverge too much, it's best to part ways.- locked and limited conversation to collaborators
on Jun 19, 2018
Withdrawn