[Q] Is a vertical bar necessary in block?

Stefan Matthias Aust sma at netsurf.de
Sat May 15 17:03:25 UTC 1999


Reinier van Loon wrote:

>I was wondering why the vertical bar is necessary in a block.

I think, it's just syntactical suggar. Perhaps a left-over from
Smalltalk-76 or older versions? In ST-76, for example, normal methods
looked like

store: val into: field | lobits
  [ "..."
  ]

>I consider a block to be an unnamed method where each colon in a block
>denotes a parameter just as in a normal method.
>
>[ : a : b ] could be viewed as a method with selector :: (colon-colon).

This triggered the following idea in my head: But then, why not also allow
anonymous parameters in normal keyword method, like

doSomething: a : b
  "..."

which is then called as

  self doSomething: 1 : 2


MfG
--
Stefan Matthias Aust  //  Bevor wir fallen, fallen wir lieber auf.





More information about the Squeak-dev mailing list