Hacker News new | past | comments | ask | show | jobs | submit login

It can be used as an enum and might be more convenient in places where you don't need to bother converting between string data outside the system and enum data types.

It also plays nicely with union types, so that you can very quickly define as hoc enums directly in your function declarations, which might be useful if there's only one or two usages of a particular enum, or a section of code where the allowable values very quickly changes.

You basically get a lot of expressiveness without boilerplate, which can be pretty convenient.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: