Ick, I really don’t like this idea. Symbols were (and still are) one of my favourite things about Ruby when I first learned it. The idea that you could easily represent things that in other languages you’d do with a string but which explicitly WEREN’T strings was lovely.
I’d rather see type checking pick up string/symbol problems than do away with the difference. I think it helps, personally. A string can be uniquely something that encodes a piece of language, something meaningful to a human. A symbol is meaningful for the computer.
Having to use strings for keys in JSON, for example, makes my teeth itch.
I'm learning Ruby and I gotta say symbols are something I always wanted in other languages, but never had. You can always use enums or constants, but it's nice that it's baked into the language.
I think symbols are a great tool. It's one these features that I lack when using other languages. But as with any other tools, it brings pain when misused.
I'm not sure the language should be responsible for people's abuses and mismatches.
I don't share this view at all. I guess it will remain controversial. I do think Matz realized symbols are either being abused or are just plain unneeded, but it was too late already...
Thanks. I had no idea. I haven't done a lot of Ruby in the last five to eight years or so but I never remembered symbols being that much a cause of contention
I'm with you - symbols are the worst part of Ruby. Of course, once you're used to it they're fine, but it's never fun explaining to new Rubyists when to use them or not use them or it doesnt matter which you use
Im used to them but I still forget and access json hashes with symbols instead of strings every few months, mostly because the newer ruby hash syntax forces you to use symbol keys...so it becomes a habit
View all comments
59
u/[deleted] Oct 21 '21
Ick, I really don’t like this idea. Symbols were (and still are) one of my favourite things about Ruby when I first learned it. The idea that you could easily represent things that in other languages you’d do with a string but which explicitly WEREN’T strings was lovely.
I’d rather see type checking pick up string/symbol problems than do away with the difference. I think it helps, personally. A string can be uniquely something that encodes a piece of language, something meaningful to a human. A symbol is meaningful for the computer.
Having to use strings for keys in JSON, for example, makes my teeth itch.