[Newbies] Re: Defining a binary message selector

Andy Burnett andy.burnett at knowinnovation.com
Sun Nov 15 22:19:38 UTC 2009


Michael said <<

Hi Andy,

why would the message have to be binary anyway? If you want the k-th
Fibonacci number, why don't you just send #fib to k?

Regarding symbols vs. not symbols: all selectors are symbols,
internally. I might get something in your e-mail wrong - could you
restate the question?

>>

Hi Michael
Thanks very much for your thoughts. Let me try to explain myself, slightly
more clearly!

First, this was just an experiment. I was reading a book on Python, saw how
they did it, and thought I would try in Squeak. So, I hadn't really thought
about how I was going to use it.  I like your suggestion about implementing
is as:  anInteger #fib.  However, thinking about implementing it as a binary
message made me curious about why I couldn't do that.

The specific problem I am having is:
If I define an Integer method such as

<<<*** aNumber

Squeak is quite happy to let me create it.  However, if I do something
like    fib aNumber, the compiler complains that aNumber is a unknown
variable, which I need to define.  So, what I was really trying to
understand was what it was about the e.g. <<< symbol which allowed it to
have an undeclared argument.

I think that, based on your last message, it is just that <<< etc have been
defined as special characters. Is that correct?

Cheers
Andy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20091115/5ce51637/attachment.htm


More information about the Beginners mailing list