3 ms·
Why are strings overloaded past their breaking point?
by onlyrealcuzzo 4y ago
Why are strings overloaded past their breaking point?
- sleeplessworld 4y agoI also don't know why. But I like the wording. This can be a new meme for programming language afficionado-skeptics: feature [...] is overloaded past its breaking point. Sent to the demi-gods at the meme ™ registrar office.
- Pet_Ant 4y agoThere seems to be some interest, so this isn't the best written, but here you go: Strings are too flexible. They can be used for anything and there should be semantic guard rails to types. Just like you never actually need booleans and enums, you could just use integers for both of those. I have seen developers instead of use strings instead of lists and just comma separate them. Strings are just a collection of characters with no restrictions to them. If you are going to add restrictions make them something else, create a better abstraction. I mean you wouldn't make a database just be nvarchar even if you could, because you aren't capturing semantic intent. Symbols do not have to be preserved at runtime, but do need to align during compilation. I mean should you be able to do string concatenation on a string in an import statement? How about to upper-case on it. If it doesn't behave like a string then it shouldn't look like one.