[6 / 0 / ?]
Quoted By:
Lisps have a special data type called a "symbol." If you compare two symbols with the same name against each other with
Most of the more modern dynamic languages, however, use "interned" immutable strings, such that any two identical strings are guaranteed to be stored in the same memory location and thus be (the language's equivalent of)
Given this development, what is the purpose of differentiating between strings and symbols in a modern programming language? Lua programs, for instance, get by just fine using its immutable strings in much the same way that a Scheme user would use symbols. Are they practically the same thing, just stored in a different namespace, as Common Lisp stores variables and functions in separate namespaces? Is this just some historical cruft that Scheme accumulated from a time when interning immutable strings was not practical, or is there some real benefit that comes from distinguishing between the two?
eq?
the result is guaranteed to be true. This is apparently not the case with strings, at least in Scheme; two identical strings are not guaranteed to be eq?
/be located in the same memory location.Most of the more modern dynamic languages, however, use "interned" immutable strings, such that any two identical strings are guaranteed to be stored in the same memory location and thus be (the language's equivalent of)
eq?
.Given this development, what is the purpose of differentiating between strings and symbols in a modern programming language? Lua programs, for instance, get by just fine using its immutable strings in much the same way that a Scheme user would use symbols. Are they practically the same thing, just stored in a different namespace, as Common Lisp stores variables and functions in separate namespaces? Is this just some historical cruft that Scheme accumulated from a time when interning immutable strings was not practical, or is there some real benefit that comes from distinguishing between the two?