Hallo, Mathieu Bouchard hat gesagt: // Mathieu Bouchard wrote:
On Mon, 23 Feb 2009, Phil Stone wrote:
Oh! Very good. I didn't realize that an identical symbol would get
re-used. For completeness' sake, I will make a new [ps-stopwatch] that does not leak (and is plain vanilla, to boot).Yes, it's re-used, which sort of goes with the fact that it doesn't get de-allocated, but that is also because it's less trouble (for pd itself) to have eternal symbols than mortal symbols.
But the re-use also goes with the fact that it's easier and faster to
compare two symbol addresses (t_symbol *) than two string contents, and
if pd _ensures_ re-use, then two identical addresses _mean_ two identical strings.But all this pd symbol concept comes essentially as-is from 1961 LISP. It was then adopted by LOGO and Smalltalk in addition to all of the LISP
variants, and then by Ruby, and then the Ruby guys figured out that in the end, a symbol type could be pretty useless if you had a good enough string type, so they almost merged them. Most other languages just have had a string type and improved on that instead of having symbol-vs-string or just symbols. All this to say I'm in favour of replacing symbols with
strings (while still calling them "symbols" just because).
Is there a difference between symbols and immutable strings like Lua or Java have them?
Frank Barknecht Do You RjDj.me? _ ______footils.org__