Le 3/7/15 11:53, Matthieu Lacaton a écrit :
Well, thanks for the documentation, the first article was quite interesting and I'm gonna get this book asap :)

    When you execute a block (far away from the place it was created),
    it acts as an exception, it stops the execution of currently
    executed methods and
    return to its home context (method that led to the creation of the
    block) Read deep into Pharo because this is a great chapter.
    So people should avoid to put return statement into a block since
    a block returns already the value of its last expression.


    So for me
        arg: [ ^ ... ]

    is a big warning.


Thanks for the explanation, I need to read this chapter, right :p

By the way, I've always used return statements in blocks to "break" out of loops since i didn't find any "break" method in Pharo. Is that bad too ?

no this correct.


ifTrue: [^ self and other]
is a natural pattern

I tend to do

    ^ ,.,.,.
            ifTrue:
            ifFalse:

    instead of

        ,mm.,.
            ifTrue: ^
            ifFalse: ^

because I prefer and in VW this is was creating easier to optimise blocks

Now the wrong pattern is

    hhhh foo: [^ self]

where foo: is not a defined control flow because here you really mean. I want to get back here.
and this is different from

    hhhh foo: [ self ]


2015-07-03 10:11 GMT+02:00 Peter Uhnák <i.uh...@gmail.com <mailto:i.uh...@gmail.com>>:

    by the way

        nextOrNextAfterNext := stream next ifNil: [stream next].


    I would argue that almost every person who would read this would
    think it's a bug and it should be ifNotNil:

    Also there would be no point in saving it to a variable if you
    will just return.
    ^ stream next ifNil: [ stream next ]



Reply via email to