Dave Storrs wrote:
> It isn't terribly clear to me either

Well, he does give a couple references that would clear it up.
X11 Atoms are well documented.

> saying is that you can qs() a method name, get a "thingie" out, store the
> thingine in a scalar, and then that scalar becomes a direct portal to the
> method...somewhat like a coderef, but without a required deref.

Actually it's more trivial than that. When you "intern" a symbol, you're
adding a string-to-integer mapping to the compiler's symbol table. Whenever
the compiler sees the string, it replaces it with the corresponding
integer. (The type stays "symbol" though; I'm sort of mixing implementation
and semantics.) Think of it like a compile-time hash for barewords.

Dan was right to think of this as a C enum equivalent. The only real
differences being that you don't have a chance to define the integer
mapping and that the printable identity of the symbol is remembered by
the run-time.

I'm not sure I'm as enthusiastic about symbols speeding things up as
the RFC author though. I guess it speeds up hash lookups and stuff, but
that could be memoized by the compiler anyways.

- Ken

Reply via email to