Re: [Pharo-users] inquiring question about ifTrue: implementation

2018-03-19 Thread Stephane Ducasse
+ 1 :) On Mon, Mar 19, 2018 at 2:16 PM, Petr Fischer wrote: > That sounds correct. In this context, my "universal ifTrue:" is really > terrible idea. > > Thanks for clarification! pf > > >> Why would you do such aberration? >> >> It goes against the "fail noisily" "Rule of

Re: [Pharo-users] inquiring question about ifTrue: implementation

2018-03-19 Thread Richard O'Keefe
The idea in Smalltalk is to push a method as high as makes sense and no higher, so that if you send a message to an object where it really does not make sense (like trying to add two strings) you get a runtime failure. (Try asking an old-timer about automatic conversions in PL/I some time.) Now

Re: [Pharo-users] inquiring question about ifTrue: implementation

2018-03-19 Thread Petr Fischer
That sounds correct. In this context, my "universal ifTrue:" is really terrible idea. Thanks for clarification! pf > Why would you do such aberration? > > It goes against the "fail noisily" "Rule of Repair": Developers should > design programs that fail in a manner that is easy to localize

Re: [Pharo-users] inquiring question about ifTrue: implementation

2018-03-19 Thread Petr Fischer
> On 19 March 2018 at 13:40, Petr Fischer wrote: > > > > How would you define the semantics of > > > > > > 123 ifTrue: [ ... ] > > > > 123 is not "true", so, ignore the block. > > > > What anout 123 ifFalse: [ … ], then, given that 123 is not false either? Yes :) 123 is

Re: [Pharo-users] inquiring question about ifTrue: implementation

2018-03-19 Thread Esteban A. Maringolo
Why would you do such aberration? It goes against the "fail noisily" "Rule of Repair": Developers should design programs that fail in a manner that is easy to localize and diagnose or in other words “fail noisily”. This rule aims to prevent incorrect output from a program from becoming an input

Re: [Pharo-users] inquiring question about ifTrue: implementation

2018-03-19 Thread Damien Pollet
On 19 March 2018 at 13:40, Petr Fischer wrote: > > How would you define the semantics of > > > > 123 ifTrue: [ ... ] > > 123 is not "true", so, ignore the block. > What anout 123 ifFalse: [ … ], then, given that 123 is not false either?

Re: [Pharo-users] inquiring question about ifTrue: implementation

2018-03-19 Thread Petr Fischer
> Infinite recursion ? > > You use #ifTrue: in your implementation of Object>>#ifTrue: > > Plus, non-booleans cannot meaningfully respond. > > How would you define the semantics of > > 123 ifTrue: [ ... ] 123 is not "true", so, ignore the block. Do the ifTrue block only if the receiver is

Re: [Pharo-users] inquiring question about ifTrue: implementation

2018-03-19 Thread Sven Van Caekenberghe
Infinite recursion ? You use #ifTrue: in your implementation of Object>>#ifTrue: Plus, non-booleans cannot meaningfully respond. How would you define the semantics of 123 ifTrue: [ ... ] > On 19 Mar 2018, at 10:18, Petr Fischer wrote: > > Hello, I have some sort of

[Pharo-users] inquiring question about ifTrue: implementation

2018-03-19 Thread Petr Fischer
Hello, I have some sort of philosophical question about ifTrue:/ifFalse: implementation. Now, ifTrue: is defined in the Boolean class (subclassResponsibility) + in True and False classes, so, we can send this message to the boolean expressions (instances) only, otherwise DND occurs. But we