[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: multicasting (was: idea: slices)




Jecel pointed out (offline) that
> You could write
>
>     selection do: [ | :element. :distance. :speed |
>                     element moveBy: distance With: speed.
>                   ] With: distance With: speed

which is far less ugly than my code.  With optional arguments, this
wouldn't even require multiple methods, as long as one is content
with a maximum number of arguments.

Making the element argument a parent would yield what I tried in
the first place.  If it weren't that, to my surprise, blocks cannot
have parent slots.

    [ | :element. | element ifTrue: 'OK' False: 'Huh?' ] value: true
    => 'OK'.

    [ | :element*. | ifTrue: 'OK' False: 'Huh?' ] value: true
    => Syntax error.

    [ | :element. environment*. |  environment: element.
      ifTrue: 'OK' False: 'Huh?' ] value: true
    => Lookup error: ifTrue not found.

Rainer