Squeak forth and Logo

Hans-Martin Mosner hmm at heeg.de
Sat Apr 8 17:31:29 UTC 2006


Hello,
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
>
While it seems nice to be able to express dates in code like that, I am 
not sure how useful and valuable this is in practice.
How often do you need hardcoded dates, anyway? In many cases where I've 
seen this, it is a hint that we should have added a configuration 
parameter...
The single exception in the project in which I'm currently involved are 
the unit tests, because we need to set up sample objects with calendar 
dates in a repeatable way there.
In my experience, using a unary selector to convert from Strings to 
Dates is at least as readable and more useful in general:
'08.04.2006' asDate
(we're using the DD.MM.YYYY notation here)
If you really need to create Date objects from arbitrary expressions, 
the unary selector #april isn't going to help you a lot...

Cheers,
Hans-Martin



More information about the Squeak-dev mailing list