On 10 October 2010 23:25, Stéphane Ducasse <[email protected]> wrote: > > On Oct 10, 2010, at 3:07 PM, Igor Stasenko wrote: > >> On 10 October 2010 15:39, Nicolas Cellier >> <[email protected]> wrote: >>> The compiler uselessly insist on #ifNotNil: argument being a zero/one arg >>> block. >>> Thus we cannot write this xtream sentence >>> >>> process ifNotNil: #terminate. >>> >>> When the argument is not a block, Compiler should avoid inlining and >>> just send a normal message. >>> >> +1 >> >> i am also missing: >> >> someThing ifTrue: 1 ifFalse: 0 > > I hate this idea. > Let the compiler doing optimizations and please do not mix implementation and > language design. > The ***semantics*** of iftrue: is to get a thunk (in scheme parlance) > something whose evaluation is blocked. > 1 is not that! >
hmm.. what is wrong with sending real #ifTrue:ifFalse: message to boolean, if compiler can't inline it? or you think a following is a good way to write a code: blockA := [self foo ]. blockB := [ self bar ]. self zork ifTrue: [ blockA value] ifFalse: [ blockB value ] where you can just write: self zork ifTrue: blockA ifFalse: blockB ? In any way, passing anything else than block literal as argument should work. This is smalltalk, not C with static types. > Now the compiler could be smart and inline whatever. > > Stef > _______________________________________________ > Pharo-project mailing list > [email protected] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > -- Best regards, Igor Stasenko AKA sig. _______________________________________________ Pharo-project mailing list [email protected] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
