this post was submitted on 09 Feb 2024
91 points (88.9% liked)
Programming
17344 readers
150 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities !webdev@programming.dev
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Symbols display with friendly string-y names in a number of languages. Clojure, for example, has a symbol type.
And a number of languages display friendly strings for enumy things - Scala, Haskell, and Rust spring to mind.
The problem with strings over enums with a nice debugging display is that the string type is too wide. Strings don't tell you what values are valid, strings don't catch typos at compile time, and they're murder when refactoring.
Clojure symbols are good at differentiation between symbolly things and strings, though they don't catch typos.
The other problem the article mentions is strings over a proper struct/adt/class hierarchy is that strings don't really have any structure to them. Concatenating strings is brittle compared to building up an AST then rendering it at the end.
Edit: autocorrect messed a few things up I didn't catch.