3 ms·
> I've always been confused by why Ruby uses symbols so much. Good: Other people mainly covered it. Also note that when writing extensions using the C API, acc
by mnarayan01 9y ago
> I've always been confused by why Ruby uses symbols so much.
Good: Other people mainly covered it. Also note that when writing extensions using the C API, accepting options as symbols is generally much more convenient.
Less good:
val = "something"
val = :something
# Saves one character and no need for an end token.
{ "key" => val }
{ key: val }
# Saves four characters.