Re:Why Ruby Has Symbols
by matheusmoreira on Thursday April 14, 2022 @02:20PM
(#31031106)
String equality is linear time in the worst case. Symbol equality is constant time. Symbols are strings that act like numeric constants. They're extremely useful in APIs as arguments, return values and generalized tokens. They're also the obvious choice for hash table keys.
[ Parent
| on HN ]
There are no comments on this comment yet.