Squeak forth and Logo
Alan Kay
alan.kay at squeakland.org
Sat Apr 8 15:13:03 UTC 2006
Check out the original Smalltalk-72. It was a very extensible language at
all levels and nothing special had to be done if you wanted to use a number
as a selector.
Cheers,
Alan
-----------
At 03:49 AM 4/8/2006, Francisco Garau wrote:
>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
|