I think the article makes a good point, but perhaps I’m over-interpreting. It’s not that we should stop using strings. It’s that we should use the type system to separate different kinds of strings and enlist the compiler’s help to detect incorrect mingling of them. So for example a Symbol type would only permit strings that contain ASCII letters, underscore and digits, and concatenation would be limited.
Comment on Strings do too many things
darkmatternoodlecow@programming.dev 9 months ago
Yeah! And integers do way too many things as well. Counters, indexes, number of orange slices in an orange, there’s just no end to the wacky things people try to make integers do, and it’s impossible to keep track of it all when looking at code. And floats? Don’t get me started on floats. Angles, probabilities, weights, heights, degrees of separation from Kevin Bacon … I’m getting dizzy just listing all these different things that floats do.
It’s a big problem, because there isn’t an easy way to fix it in every programming language known to man, and someone needs to write more articles about this to get more hits for their sites.
tias@discuss.tchncs.de 9 months ago
dudinax@programming.dev 9 months ago
What’s the meaning of a fractional “Degree of Kevin Bacon”?
kogasa@programming.dev 9 months ago
The analytic continuation of KB(x) to the complex plane subject to a superconvexivity constraint is unique but doesn’t necessarily have a straightforward geometric interpretation
chickenf622@sh.itjust.works 9 months ago
It’s definitely a rule that can be taken so far that it is counterproductive, but I think it’s good practice to thbk about how I could use something other than a raw string ( even if it’s just a constant defined somewhere )
corytheboyd@kbin.social 9 months ago
You joke, but Rails actually does literally make Integer do too many things lol. I’d argue they’re useful things, but it does so by patching the core Ruby Integer class :p
andrew@lemmy.stuart.fun 9 months ago
Wait till you hear what strings are under the hood. Integers in a trench coat!
darkmatternoodlecow@programming.dev 9 months ago
And the boolean is revealed as the archvillain working behind the scenes, pulling the strings of all its minions.
nitefox@sh.itjust.works [bot] 9 months ago
You thought it was true but it was I, One!
jaybone@lemmy.world 9 months ago
It’s integers all the way down.