← Back to context

Comment by bhaak

2 hours ago

> I'm pretty sure it's fine to use strings as hash keys though if you like.

Sure. They are just less efficient as hash keys.

Although now the distinction blurs with frozen strings (and the string literals being frozen by default switch).

Ruby has always had frozen strings (what it didn't have was interning of string literals, which is what the somewhat-poorly-named "# frozen_string_literal: true" option available from Ruby 2.3 and made default in Ruby 3.4 actually does, which makes string literals basically equivalent to symbol—but, not actually symbols, unlike, in another example of suboptimal naming, what would happen with String#intern, which has existed longer to intern strings, but is actually just an alias of String#to_sym.