Problem with symbol interning

Tony Garnock-Jones tonyg at lshift.net
Sun May 14 16:07:04 PDT 2006


Hi. Just wrote the following in IRC:

<tonyg> Hi all
<tonyg> Problem with symbols? ('a' as: Symbol) == #a ---> False
<tonyg> (#as: findOn: {'a'. Symbol}) == (#as: findOn: {String. Symbol})
<tonyg> ... is also False
<tonyg> Weird!
<tonyg> and problematic. It causes extlib.slate to behave strangely
around type-registration.

It looks like something is funny with the inheritance graph of Symbols
that causes them to match some other instance of #as: than the one
defined for {String. Symbol}. This causes problems in, for instance,
extlib.slate, since it construct symbols and adds slots with the
constructed symbols for names. If the symbols aren't interned, they're
inaccessible (except presumably via reflective protocols).

For instance:

  CObject parseDefinitionsFrom:
    #(('Timeval' (Structure ('seconds' LongInt)
                            ('nanoseconds' LongInt))))
  into: lobby.

is supposed to create _Timeval and Timeval. It creates _Timeval OK,
because it uses "('_' ; name) intern", but ends up creating a slot
called Timeval that is inaccessible because the symbol naming the slot
is uninterned!

How do we fix this? In the meantime, I'm using a hacked-on extlib.slate
that sends intern explicitly... not cool.

Tony



More information about the Slate mailing list