Here’s a wacky #Ruby idea…
What if only symbols for hash keys?
How much code would that break?
How much of that is actually non-symbol-able?
I.e.
{ “Shane Becker” => “veganstraightedge” }
Here’s a wacky #Ruby idea…
What if only symbols for hash keys?
How much code would that break?
How much of that is actually non-symbol-able?
I.e.
{ “Shane Becker” => “veganstraightedge” }
Replying to @veganstraightedge@ruby.social
@veganstraightedge :"test test" is a symbol, would you just end up with some to_sym under the hood?
Replying to @andrewnez@mastodon.social
@andrewnez in this wacky hypothetical… that'd not be a valid legal symbol
only symbol safe names could be symbol keys
azAZ09_
(like a hashtag)
¯\_(ツ)_/¯
Replying to @veganstraightedge@ruby.social
@veganstraightedge oh I get you, I’m a fan, the only thing that would break for me is using them mechanically as autogenerated dictionaries
Replying to @andrewnez@mastodon.social
@andrewnez say more about that pls?
Replying to @veganstraightedge@ruby.social
@veganstraightedge if I’m looping through a big dataset and incrementing counters for undefined number of strings, I use the string as the key in the hash with an initial value of zero, and increment from there. Then by the end I have a hash with string keys and int values
Replying to @andrewnez@mastodon.social
@andrewnez ah right. and sluggifying the string to symbol wouldn't work because it's not not roundtrippable, right?
"Shane Becker" #=> :shane_becker
"HTTP.rb" #=> :http_rb