Perhaps naive question about the colon.
Blake
blake at kingdomrpg.com
Thu Dec 2 12:23:31 UTC 2004
On Thu, 02 Dec 2004 12:59:04 +0100, Andreas Nilsson <wahboh at mac.com> wrote:
> I'd say there's a difference between:
> caveman light: fire with: flintAndTinder usingForFuel: twigsAndStraw
>
> and:
> caveman light fire with flintAndTinder usingForFuel twigsAndStraw
>
> The first example is calling a method with arguments to tell it what to
> do while the second simply calls the methods twigsAndStraw,
> usingForFuel, flintAndTinder, with, fire and light on the caveman object.
> You could, I suppose, write classes that has methods instead of
> arguments and rely on people calling them in the right order but I
> wouldn't recommend it.
>
> The second example could also be used like this:
> caveman flindAndTinder twigsAndStraw usingForFuel with fire light
Well, as I said, it was a conceptual (perceptual? habitual?) issue. I
don't think of terms in consecutive statements--a hold over from more
procedural langugaes, so I'd "intuit" a special punctuation for multiple
sends. In other words, in Smalltalk, you'd send three messages with one
parm each as:
Caveman find: flint gather: twigs light:fire.
whereas, I would expect punctuation for the separation versus for the
parameters:
Caveman find flint, gather twigs, light fire. "Three messages, one parm
each."
I can't defend my expectations. Just trying to become aware of them.
More information about the Squeak-dev
mailing list
|