Perhaps naive question about the colon.

Blake blake at kingdomrpg.com
Thu Dec 2 12:56:31 UTC 2004


On Thu, 2 Dec 2004 12:47:18 -0000, Frank Shearar  
<Frank.Shearar at rnid.org.uk> wrote:

>> 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:

Doh! Right. See, you can tell I haven't used them much lately. I'm the  
same way with C. I'll start out writing

C = C + 1;
D = C + 1;

then:

C++;
D = C;

then

D = C++; //or is it D = ++C; ?

I always fall back on plain code but get more comfortable with the idioms  
for better (Smalltalk) or worse (C)<s>.

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

That's the one. That looks right, even.<s>

> which is a neater way of saying
>
> Caveman find: flint.
> Caveman gather: twigs.
> Caveman light: fire.

Exactly. or, in Object Pascal,

with Caveman do
begin
    Find(Flint);
    Gather(Twigs);
    Light(Fire);
    end;

OK, good, I get the Smalltalk syntax now and like it.<s>



More information about the Squeak-dev mailing list