I haven't seen this discussed on ESDiscuss before. For those not
familiar with user-defined literals: Essentially, they allow certain
literals (e.g. 123.45, "hello") to produce a user-defined object by
marking the literal with a user-defined suffix.
They were introduced in C++11 , and I'm not sure if any other
language has implemented them.They were also discussed on Python-ideas .
Some potential use cases:
- Since ES2015, built-ins are subclassable, so you could use a literal
to call custom constructors (e.g. for custom string objects)
- Units (e.g. `100m + 2cm`)
- Numbers may be specified in arbitrary bases (e.g. `124_9 ===
- Complex numbers, quaternions, … (you could make these even nicer with