'Path' implementation
Lee Salzman
lsalzman1 at cox.net
Wed Sep 8 18:54:52 PDT 2004
On Wed, Sep 08, 2004 at 06:43:53PM +0200, Pavel Holejsovsky wrote:
> ***********************************************************************
> First difficulty I met was 'Types Type rules' object. This beast
> doesn't have any 'traits' slot (yuck), and therefore (as the comment in
> src/mobius/types.slate says), all methods must be dispatched by sendTo:
> instead of direct calls. This means that it is not even possible to
> insert it into IdentitySet etc. I did not want to 'pollute' the
> implementation of the Path by using sendTo: instead of normal method
> calls, so I closed the appropriate code in "[] breakOn: MethodNotFound"
> envelope and it seems to work - 'Types Type rules' is simply ignored
> when searching for path. Is there any more elegant solution for this?
>
I think your solution is the most general. You could check for a traits
slot on an object before messing with it, but even then, there could
still be problematic objects in the future that this deals with easily
enough.
> ***********************************************************************
> hash/= methods - I thought that 'hash' *must* return the same value for
> any two objects for which '=' returns True. But:
>
> > addSlot: #a1 valued: {0}.
> {0}
> > addSlot: #a2 valued: {0}.
> {0}
> > a1 = a2.
> True
> > a1 hash.
> 102089623
> > a2 hash.
> 127015919
>
> Is this complete misconception on my side, or some problem in current
> slate implementation?
>
This was just a bug. Someone wrote the hash methods to use identityHash
of the collection themselves, rather than the collection type. It's been
fixed in CVS.
More information about the Slate
mailing list