On 5 Mar 2017, at 19:53, Martin McClure <martin@hand2mouse.com> wrote:
On 03/05/2017 03:01 AM, Sven Van Caekenberghe wrote:
I also think that allowing concatenation on Symbols does not violate their immutability contract.
As a thought experiment, what could be the problem with adding
Symbol >> , arg ^ (self , arg) asSymbol
?
Aside from the infinite recursion (I suspect you meant super rather than self) :-) , I wouldn't have any problem with that.
Haha, I copied it from lower in the thread, but shame on me that I didn't see that right away !
(I have found the original issue raised annoying as well)
On 5 Mar 2017, at 11:35, Peter Uhnak <i.uhnak@gmail.com> wrote:
I don't need (or want) to mutate the receiver. Actually I thought that String is also immutable. $, could just return a new symbol instance instead. Concating symbols is quite practical for metaprogramming, as most things are named with symbols and compare by identity...
Somewhat unfortunately, imho, Smalltalk Strings are mutable. I've not seen this feature used often, except by internal operations that could just as well be using a CharacterBuffer or whatever would replace String as the mutable thing if you made String immutable.
Yes, this distinction, with a default for immutable ones, would be good. We got #beReadOnlyObject in Pharo, so I guess we can start experimenting. Especially literal strings should be read only.
Regards,
-Martin