[Newbies] Defining a binary message selector

Andy Burnett andy.burnett at knowinnovation.com
Sun Nov 15 19:02:13 UTC 2009

As an experiment, I tried to create a Fibonacci method for Integer.
Initially, I defined it as Integer>>fibonacci: aNumber. However, having
thought about it a bit more I realised that it should probably be a binary
message like '+'. I tried to create it as such, but Squeak wouldn't let me -
even when I copied the code from the '+' method.

After a bit of head scratching, I decided that '+' was probably a symbol,
and that binary messages are probably limited to using symbols as selectors.
However, I once arrived late to a baseball game (never having seen it played
before), got confused about which team was which, and invented an entirely
new scoring system that pretty much explained the results on the
scoreboard.  So, I may be completely wrong about binary selectors!

If I am right about them requiring to be symbols.  Would it be a good idea
for meto make 'fibonacci' a symbol as well? Or would that lead to unintended
problems down the road?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20091115/468d9fcf/attachment.htm

More information about the Beginners mailing list