--- Begin Message ---Issue submitted: https://github.com/pharo-project/pharo/issues/2744pf > > On 1 Mar 2019, at 17:08, Petr Fischer via Pharo-users > > <pharo-users@lists.pharo.org> wrote: > > > > > > From: Petr Fischer <petr.fisc...@me.com> > > 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: > > > > 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 > > > > Look at line 4 - what does it mean? That's wrong, isn't it? > > > > Typically, every symbol comparisons end up in line 3, but if you do some > > work with forward proxies for example, condition on line 3 is "false" and > > then weird things on line 4 happens. > > > > If line 4 and further are correct, can someone explain a little? > > > > Thanks! pf > > Yes, that looks weird. Line 4 should probably be removed, unless I am missing > something. > > Symbols are by definition always #== so in that sense, #= should not even be > implemented (as #= on Object is defined as #==), but since its direct super > class String already overwrote #=, it has to follow. > > The super call in line 6 is what allows Symbols and String to be compared. > > I would say line 4 is a kind of sanity check, but probably not needed. > >
--- End Message ---
Re: [Pharo-users] Symbol equality method #= - issue submitted
Petr Fischer via Pharo-users Fri, 01 Mar 2019 08:50:13 -0800
- [Pharo-users] Symbol equality method #= - wei... Petr Fischer via Pharo-users
- Re: [Pharo-users] Symbol equality method... Sven Van Caekenberghe
- Re: [Pharo-users] Symbol equality me... Petr Fischer via Pharo-users
- Re: [Pharo-users] Symbol equality me... David T. Lewis
- Re: [Pharo-users] Symbol equalit... Sven Van Caekenberghe
- Re: [Pharo-users] Symbol equ... Steffen Märcker
- Re: [Pharo-users] Symbol equ... Sven Van Caekenberghe
- Re: [Pharo-users] Symbo... Richard Sargent
- Re: [Pharo-users] S... Sean P. DeNigris
- Re: [Pharo-users] Symbo... Richard O'Keefe
- Re: [Pharo-users] S... Sven Van Caekenberghe