This is an automated archive made by the Lemmit Bot.
The original was posted on /r/programminglanguages by /u/NoCryptographer414 on 2024-11-04 19:01:17+00:00.
For eg, to create a date constant, the way is to invoke date constructor with possibly named arguments like
let dt = Date(day=5, month=11, year=2024)
Or if constructor supports string input, then
let dt = Date("2024/11/05")
Would it be helpful for a language to provide a way to define custom literals as an alternate to string input? Like
let dt = date#2024/11/05
This internally should do string parsing anyways, and hence is exactly same as above example.
But I was wondering weather a separate syntax for defining custom literals would make the code a little bit neater rather than using a bunch of strings everywhere.
Also, maybe the IDE can do a better syntax highlighting for these literals instead of generic colour used by all strings. Wanted to hear your opinions on this feature for a language.