On 6 March 2017 at 15:21, Sven Van Caekenberghe <s...@stfx.eu> wrote:
> > > On 6 Mar 2017, at 14:12, Ben Coman <b...@openinworld.com> wrote: > > > > > > > > On Mon, Mar 6, 2017 at 5:54 PM, Sven Van Caekenberghe <s...@stfx.eu> > wrote: > > Here is a concrete proposal: > > > > https://pharo.fogbugz.com/f/cases/19802/Make-sure-Symbol- > concatenation-results-in-a-Symbol-not-a-String > > > > This gives the following assertions: > > > > "Concatenating 2 symbols results in abother symbol" > > self assert: (#foo , #bar) == #foobar. > > > > "Concatenating the empty symbol does not change a symbol" > > self assert: (#foo, emptySymbol) == #foo. > > self assert: (emptySymbol, #foo) == #foo. > > > > "Strings and symbols can still be mixed, the receiver determines > the result type" > > "Symbol receiver gives symbol result" > > self assert: (#foo , 'bar') == #foobar. > > "String receiver gives string result" > > self deny: ('foo' , #bar) == #foobar. > > self assert: ('foo' , #bar) equals: #foobar. > > self assert: ('foo' , #bar) equals: 'foobar'. > > > > > > Those last two seem contradictory. > > No, Symbols and String can be used interchangeably in Pharo in lots of > contexts. Particularly when comparing them, it makes no difference, all the > following are/have always been true, independent of this change: > > #foo = 'foo' > 'foo' = #foo > #foo = #foo > 'foo' = 'foo' > > But maybe it is a bit confusing with an extra comment. > > You got me with this... Hey, stop confusing people, put #== everywhere! :) But if seriously, #assert:equals: hides this detail from us, that's why it looks confusing.. IMO, for given case it would be better to use just straight #assert:, with explicit expression that using #= for comparands. -- Best regards, Igor Stasenko.