swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compare function followup


From: Marcus G. Daniels
Subject: Re: Compare function followup
Date: 17 Sep 1999 11:46:41 -0700
User-agent: Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.4

>>>>> "PJ" == Paul Johnson <address@hidden> writes:

PJ> If a program uses a Map without specifying the comparison
PJ> function, then does swarm assume the comparison is the internal
PJ> function compareID?  In the grid3.m, this seems to be what
PJ> happens. 

It then assumes the keys are objects and sends the message `compare:'.
In grid3.m, the keys are instances of String.  String implements compare:.

PJ> ALthough it is described as a comparison of strings, I
PJ> believe it is putting C strings into String objects, and then the
PJ> keys are treated as equal only when the "id's" of the objects are
PJ> the same.  This amounts to checking if the memory address of 2
PJ> objects is the same.  Otherwise,it would be necessary to declare a
PJ> compare function.

Neither String instances of C strings can be compared by comparing 
pointers; their contents must be examined.

PJ> At one level it is nice to know that objects can be inserted in
PJ> any number of ways, but what I strive for is the simple
PJ> bottom-line of what is "best" and what ought to be taught.

Object wrappers for everything. 

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]