Re:Why Ruby Has Symbols
by TazeTSchnitzel on Thursday April 14, 2022 @07:34AM
(#31025497)
You can intern strings without preventing mutability using the copy-on-write principle. PHP does it.
[ Parent
| on HN ]
If you copy before you write, you're not mutating, you're making a new thing.
e.g. This pseudo code must stand for mutation to be present.
a = ...
b = a
mutate(a)
/* b now mirrors a */
Re:Why Ruby Has Symbols
by TazeTSchnitzel on Thursday April 14, 2022 @04:25PM
(#31032801)
A language runtime can make that work if it wants to. High-level semantics don't need to constrain the implementation.