Squeak forth and Logo

Alan Lovejoy squeak-dev.sourcery at forum-mail.net
Sat Apr 8 16:48:02 UTC 2006


Try either "30 april, 2006" or "2006 april: 30"

--Alan

-----Original Message-----
From: squeak-dev-bounces at lists.squeakfoundation.org
[mailto:squeak-dev-bounces at lists.squeakfoundation.org] On Behalf Of
Francisco Garau
Sent: Saturday, April 08, 2006 3:49 AM
To: Squeak List
Subject: Squeak forth and Logo

I am having fun with dates, and I can build them with the following
expression:

    2006 year april dayNumber: 30

I don't like the keyword selector there, because it breaks the beauty of the
expression and forces parenthesis afterwards. It would be nicer if I could
write:

    2006 year april 30

It would never had occurred to me that numbers *could* be selectors if I
hadn't taken a look at Forth. In that amazing little language *anything* can
be a selector (eg. #?! or ^%* are valid selectors or word names, as they
call them).

As a comprise, I decided to use the following expression:

    2006 year april day30

But that leaves me with another problem. Basically defining 31 methods like
this:

    TmActualMonth>>day30
        ^ self dayNumber: 30

Very boring. In the very Logo way, I created a method that creates those
boring methods:

    TmActualMonth class>>installBoringMethods
        (1 to: 31) collect: [:number |
            self fakeCompile:
                (String streamContents:
                    [:stream |
                    stream
                        nextPutAll: 'day';
                        print: number; cr; tab;
                        nextPutAll: '^ self dayNumber: ';
                        print: number ] ) ]

Now I have to rush to our first UK Smalltalk meeting. Stephen Taylor from
APL fame will be giving a presentation. It seems that there are lots of
similarities between the APL and the Smalltalk community. But we are
bigger!!

-Francisco











More information about the Squeak-dev mailing list