We did that in a financial system that uses Aconcagua and Chalten.... so you have things like:

InterestRate yearlyOf: 10 percent.
InterestRate of: 10 percent every: 6 months.

and of course:

Interest simpleFor: 100 dollars with: (InterestRate yearlyOf: 10 percent) during: 10 years.
and
Interest compoundFor: 100 dollras with: (InterestRate yearlyOf: 10 percent) during: 10 years withPeriodsOf: 6 months

And of course more complex things... anyway, some people call this DSL... :-)


On Fri, Oct 9, 2009 at 10:19 AM, Torsten Bergmann <astares@gmx.de> wrote:
Reminds me again how close Smalltalk comes to the real world.

Dont know if the interest rate of 0.1 is still valid after
the financial crisis ;) but I always liked this natural
expression style of Smalltalk:

�initialCapital := 100 dollars.
�interestRate := 0.1 / 1 year.

Especially the ease of "1 year", "1 month" or "Date today".
If you ever worked with the date and calendar mess in Java
you know what I'm talking about. I can even write:

� 100 m2
� 100 USD
� 100 EUR
� 100 �

Unfortunately I cant (yet) write unary messages like this in Smalltalk:

�100 $
�100 %

Wonder why not. Parser gives "Message pattern expected", maybe
because of unary vs. binary.

Have to think about it ...


--
GRATIS f�r alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01

_______________________________________________
Pharo-project mailing list
Pharo-project@lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project