[squeak-dev] MethodNodes on Monticello (was: The Inbox: Kernel-ct.1339.mcz)

Eliot Miranda eliot.miranda at gmail.com
Fri Nov 20 21:19:27 UTC 2020


On Fri, Nov 20, 2020 at 6:51 AM Jakob Reschke <forums.jakob at resfarm.de>
wrote:

> Am Fr., 20. Nov. 2020 um 13:42 Uhr schrieb Thiede, Christoph
> <Christoph.Thiede at student.hpi.uni-potsdam.de>:
> >
> > The problem is that when writing the opening bracket on the same line as
> the first block statement, the block statements will look inconsistently
> intended:
> >
> > someBoolean
> >     ifTrue:
> >         [self doOneThing.
> >         self doAnotherThing.
> >         "Do you notice the visual glitch above?"].
> >
>
> This used to bug me, too. But eventually I realized that it does not
> really matter for my reading comprehension. It's like all those
> parentheses bugging the Lisp apprentice in the beginning.
>

and I would never indent the ifTrue: unless it has a matching ifFalse:, so
the above would be

    someBoolean ifTrue:
        [self doOneThing.
        self doAnotherThing.
        "Do you notice the visual glitch above?"].

and otherwise it would be

    someBoolean
        ifTrue: [self doOneThing]
        ifFalse: [self doTheOther]

etc.

>
> Rectangular block does still have an issue when a complex block is the
> receiver of a message, such as with on:do: and ensure:
>
>     [anything
>        ifTrue:
>           [...]]
>        ensure:
>           ["do something else"
>           that ifTrue: [...]].
>
> Because the lower part of the receiver block is indented, the ensure
> could be seen as being inside of it, just at a glance.
> But the style that puts the opening bracket on the previous like does
> not solve this issue at all.
>

It does indeed.  I tend to indent the body of the block with two tabs so
that it is to the right of the ensure: or on:do:, in those cases.


_,,,^..^,,,_
best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20201120/ebfed9fb/attachment.html>


More information about the Squeak-dev mailing list