that a fun one. BTW I know that david simmons introduced == and === on symbol and === was checking the namespace in which the symbol was defined and this way he implemented selector namespace.
On Aug 24, 2010, at 4:00 PM, Igor Stasenko wrote: > On 24 August 2010 16:16, Stéphane Ducasse <[email protected]> wrote: >> we often use symbols for identity keys. >> Now I was just dreaming. >> > I had a long discussion with my friend, who was learning smalltalk, > where we argued about 'selector is not a symbol'. > > The difference between a bare string and symbol is uniqueness. > Literally, a symbol is just a string, which having additional, implied > semantics, that > same symbolic strings refer to a single, unique object. (Another minor > one is immutability). > > The difference between a symbol and selector is less significant. > A simple example. Suppose you have two different classes, one Symbol, > other is Selector. > Now, suppose that compiler creating an instance of Symbol each time it > sees following: > > self foo. > > where 'foo' is selector (and instance of Selector). > > but now, lets put it in another way: > > self perform: #foo. > > A #foo is, obviously a symbol, and must be an instance of Symbol class, isnt? > > So, in #perform: you must somehow convert a symbol into selector and > then find the implementation > of method with given selector. > This obviously kills an idea of having distinction between selectors > and symbols, because implementation > of #perform: will be awfully slow and awkward. > >>>> Hi guys >>>> >>>> I'm thinking aloud... >>>> I was wondering if we could not take advantage of a new class: Selector. >>>> MethodDict would only contain selectors and not symbols. >>>> >>>> I remember that I talked about that with hernan. >>>> >>> >>> Hmm.. i don't see obvious advantages. Do you? >>> Most symbols (90% of cases), used as selectors, so it is likely that >>> such refactoring will be nothing more, >>> but just renaming the class :) >>> >>>> Stef >>>> >>>> >>>> _______________________________________________ >>>> Pharo-users mailing list >>>> [email protected] >>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users >>>> >>> >>> >>> >>> -- >>> Best regards, >>> Igor Stasenko AKA sig. >>> >>> _______________________________________________ >>> Pharo-users mailing list >>> [email protected] >>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users >> >> >> _______________________________________________ >> Pharo-users mailing list >> [email protected] >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users >> > > > > -- > Best regards, > Igor Stasenko AKA sig. > > _______________________________________________ > Pharo-users mailing list > [email protected] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users _______________________________________________ Pharo-users mailing list [email protected] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
