Re: [Pharo-users] Symbol equality method #= - weird condition in the Pharo sourcecode

2019-03-06 Thread Sven Van Caekenberghe
> On 6 Mar 2019, at 15:15, Richard O'Keefe wrote: > > Surely a Symbol should never be #= to anything that is not > a Symbol? At least in VW, GST, Dolphin, and VAST, > #a = 'a' > 'a' = #a > both answer false, and I'd be rather upset if a symbol > ever compared equal to a string. The ANSI

Re: [Pharo-users] Symbol equality method #= - weird condition in the Pharo sourcecode

2019-03-06 Thread Richard O'Keefe
Surely a Symbol should never be #= to anything that is not a Symbol? At least in VW, GST, Dolphin, and VAST, #a = 'a' 'a' = #a both answer false, and I'd be rather upset if a symbol ever compared equal to a string. The ANSI Smalltalk standard says in several places that "Symbol objects are

Re: [Pharo-users] Symbol equality method #= - weird condition in the Pharo sourcecode

2019-03-01 Thread Sean P. DeNigris
Richard Sargent wrote > As an aside, this is the kind of information that should be in a method's > comment. Rationale and explanation, rather than what it does. Yes!!! - Cheers, Sean -- Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

Re: [Pharo-users] Symbol equality method #= - weird condition in the Pharo sourcecode

2019-03-01 Thread Richard Sargent
On Fri, Mar 1, 2019 at 12:02 PM Sven Van Caekenberghe wrote: > Ah, it is an optimisation: if the first #== fails, but the argument is > also a Symbol, then that means the are different for sure, so false is > returned early, instead of failing in super's #= after that. > > And with ByteSymbol

Re: [Pharo-users] Symbol equality method #= - weird condition in the Pharo sourcecode

2019-03-01 Thread Sven Van Caekenberghe
Ah, it is an optimisation: if the first #== fails, but the argument is also a Symbol, then that means the are different for sure, so false is returned early, instead of failing in super's #= after that. And with ByteSymbol and WideSymbol, although they are exclusive (can never be equal), they

Re: [Pharo-users] Symbol equality method #= - weird condition in the Pharo sourcecode

2019-03-01 Thread Steffen Märcker
Is it consistent with the definition of #= in String such that 'aSymbol = aString' iff 'aString = aSymbol'? Sorry, I don't have an image at hand. Am 1. März 2019 18:40:11 MEZ schrieb Sven Van Caekenberghe : >Why ? Please explain ... > >> On 1 Mar 2019, at 18:02, David T. Lewis wrote: >> >> On

Re: [Pharo-users] Symbol equality method #= - weird condition in the Pharo sourcecode

2019-03-01 Thread Sven Van Caekenberghe
Why ? Please explain ... > On 1 Mar 2019, at 18:02, David T. Lewis wrote: > > On Fri, Mar 01, 2019 at 05:18:27PM +0100, Sven Van Caekenberghe wrote: >> >> >>> On 1 Mar 2019, at 17:08, Petr Fischer via Pharo-users >>> wrote: >>> >>> >>> From: Petr Fischer >>> Subject: Symbol equality

Re: [Pharo-users] Symbol equality method #= - weird condition in the Pharo sourcecode

2019-03-01 Thread David T. Lewis
On Fri, Mar 01, 2019 at 05:18:27PM +0100, Sven Van Caekenberghe wrote: > > > > On 1 Mar 2019, at 17:08, Petr Fischer via Pharo-users > > wrote: > > > > > > From: Petr Fischer > > Subject: Symbol equality method #= - weird condition in the Pharo sourcecode > > Date: 1 March 2019 at 17:08:03

Re: [Pharo-users] Symbol equality method #= - weird condition in the Pharo sourcecode

2019-03-01 Thread Sven Van Caekenberghe
> On 1 Mar 2019, at 17:08, Petr Fischer via Pharo-users > wrote: > > > From: Petr Fischer > Subject: Symbol equality method #= - weird condition in the Pharo sourcecode > Date: 1 March 2019 at 17:08:03 GMT+1 > To: pharo-users@lists.pharo.org > > > Hello, this is Symbol equality method in

[Pharo-users] Symbol equality method #= - weird condition in the Pharo sourcecode

2019-03-01 Thread Petr Fischer via Pharo-users
--- Begin Message --- Hello, this is Symbol equality method in Pharo: 1: = aSymbol 2: "Compare the receiver and aSymbol." 3: self == aSymbol ifTrue: [^ true]. 4: self class == aSymbol class ifTrue: [^ false]. 5: "Use String comparison otherwise" 6: ^ super = aSymbol