text = symbol? Marc Feeley (14 Jun 2016 02:37 UTC)
Re: text = symbol? Marc Feeley (14 Jun 2016 02:40 UTC)
Re: text = symbol? Per Bothner (14 Jun 2016 03:45 UTC)
Re: text = symbol? William D Clinger (14 Jun 2016 12:58 UTC)

Re: text = symbol? Per Bothner 14 Jun 2016 03:45 UTC


On 06/13/2016 07:37 PM, Marc Feeley wrote:
> I haven’t followed all of the discussion so perhaps this comment has been made, but it strikes me as a bit odd to introduce a new type for immutable strings, “text”, when Scheme already has the “symbol” type for this concept.

Symbols have the additional property of equality being the same as identify.
To preserve this, each operation returning a string has to intern it. This could
be a pretty expensive operation, especially in a multi-threaded context where
you have to acquire a global intern-table-lock.  (A smart compiler/interpreter
might be able to optimize this in some cases: Only intern a string when it might
"escape" the current context.)

(FWIW, Kawa originally represented Scheme Symbols using Java's java.lang.String.)
--
	--Per Bothner
xxxxxx@bothner.com   http://per.bothner.com/