I generally agree about implicit type-conversions, but I don't really think this one is all that implicit. String concatentation returns a String, no exceptions. By not having this for Strings actually led to Andreas getting bitten, which is why it was added to Squeak. The "bite" comes when your program encounters an error, and in your error-handler you wrote a descriptive message, 'It didn''t work because the value is ', someOtherString. Except someOtherString is nil. Now your error-handler itself has an error, blowing up and leading you on a wild goose chase because of a trivial message-concatentation problem instead of the real problem. Can you describe an example where you feel this one could potentially bite you by its "implicitness"? On Thu, Sep 10, 2015 at 9:34 AM, Max Leske <maxleske@gmail.com> wrote:
Iâm with Sven on this. Just because JavaScript implementations (and others) choose to perform implicit type conversion doesnât mean itâs a good thing. It might make it easier for newcomers to write a hello world program but it will bite you when youâre trying to do actual work.
On 10 Sep 2015, at 16:16, Sven Van Caekenberghe <sven@stfx.eu> wrote:
No, this is not a good idea (silent conversions). It is one of the original differences between Pharo and Squeak. Try searching the MLs, I am sure it is all still there.
You can also concatenate exceptions to create an exception set, I am sure there are other examples.
On 10 Sep 2015, at 16:12, Aliaksei Syrel <alex.syrel@gmail.com> wrote:
Hi
I'm just curious why "," doesn't convert object to string during concatenation?
For example I expect 'answer is ', 42 to return 'answer is 42' instead of 'SmallInteger are not indexable'.
Of course you could say that 'answer is ', 42 asString does the job... but still why not to put asString in concatenation method
Cheers, Alex