Re:ES6 in Depth: Symbols (2015)
by mnarayan01 on Wednesday July 12, 2017 @09:45AM
(#14752448)
> 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.
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: