On Aug 23, 2010, at 9:40 AM, laurent laffont wrote:
> 
> 
> Indeed  I don't like  '2010/08/01' asTime, but I like 3 seconds.
> 

And I think the reason is the following:

 '2010/08/01' asTime

this is just code... "string, you smalltalk object, please convert yourself 
into an object of another class that
you normally should know too much about". No reason why not to ask the Time 
class: hey, time,
I have a string, can you make a time for me? And it's even nicer... Time knows 
about time, string
about being a string.

BUT:

1 second + 3 hours

This is different. This is a *domain specific language* for dealing with time. 
When you read that, you do
not think in term of general smalltalk code for coverting between classes. We 
are (kind of) outside of
our language model and the rules we normally follow do not apply. (e.g. there 
is no hour and second class...). 

Domain specific languages are powerful, and one can abuse them very easily. 
(am guilty of having written once some awful DSL where even the *name* of a 
block 
parameter had semantic meaning ;-)

         Marcus

--
Marcus Denker  -- http://www.marcusdenker.de
INRIA Lille -- Nord Europe. Team RMoD.

_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to