Perhaps naive question about the colon.

Frank Shearar Frank.Shearar at rnid.org.uk
Thu Dec 2 12:47:18 UTC 2004


Blake <blake at kingdomrpg.com> wrote:
> 
> 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.

This actually sends the message #find:gather:light. If you mean to send #find: then #gather: then #light: you need disambiguate using brackets:

((Caveman find: flint) gather: twigs) light: fire

(I'm ignoring semantics here - you probably don't want to send the #gather: message to the result of #find: as I do in this example!)

> whereas, I would expect punctuation for the separation versus 
> for the  
> parameters:
> 
> Caveman find flint, gather twigs, light fire. "Three 
> messages, one parm  
> each."

Ah, a cascade:

Caveman
    find: flint;
    gather: twigs;
    light: fire.

which is a neater way of saying

Caveman find: flint.
Caveman gather: twigs.
Caveman light: fire.

frank


*******************************************************************
This email and any files transmitted with it are confidential
and intended solely for the use of the individual or entity to
whom they are addressed. Any views or opinions expressed
are solely those of the author and do not necessarily represent
RNID policy.
If you are not the intended recipient you are advised that any
use, dissemination, forwarding, printing or copying of this
email is strictly prohibited.
If you have received this email in error please notify the RNID
Helpdesk by telephone on: +44 (0) 207 296 8282.
The Royal National Institute for Deaf People
Registered Office 19*23 Featherstone Street
London EC1Y 8SL No. 454169 (England)
Registered Charity No. 207720
********************************************************************




More information about the Squeak-dev mailing list