> pica color: Color r:1 g:1 b:0 .
>
> -this is as per the book but throws up a message 'MessageNotUnderstood:
> Bot>>color:r:g:b'
I would expect this to work
pica color: ( Color r: 1 g: 1 b: 0 ).
this sends the message #r:g:b: to the class Color and then the result of
that is used as the argument to the message #color: to the object pica.
Without the parenthesis you will be sending the message #color:r:g:b:
which, as the message informed you, pica doesn't understand.
There is a variation of Smalltalk called Self which changed the syntax
slightly to reduce this confusion a bit. In Self the first element of a
keyword message starts with a lower case letter while the second and
following parts start with capital letter. This allows you to get by
with fewer parenthesis since this code could be written in Self as
pica color: Color r: 1 G: 1 B: 0.
Of course, this causes its own set of confusions. So in Squeak we just
have to put in the parenthesis to make it clear what we mean. Note that
this has been this way since 1976, so it seems strange that the book
would get it wrong.
-- Jecel
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners