On 7/2/07, Yossef Mendelssohn <ymendel / pobox.com> wrote:
> If I may, you could look into a fluent interface (http://
> www.martinfowler.com/bliki/FluentInterface.html) instead of a DSL.  I
> make this distinction because "DSL" seems to have become a term
> meaning "something with lots of class methods and blocks" because
> that's one simple Ruby implementation.
>
> Michael Hollins suggested something like
>
>    charge 10.dollars do
>      on "10 July 2007"
>      repeat 12 do
>        charge 20.dollars
>        every :month
>        starting "30 July 2007"
>      end
>    end
>
>
> but how about something like
>
>
> charge(10.dollars).on(date_x).then.charge(20.dollars).every(:month).times(12).starting(date2)

You can even get more natural language using eval - imagine this expressed as:

charge 10 dollars on 07/02/2007 then charge 20 dollars every month for
12 months starting on 08/01/2007

Check out Jay Fields' writing on Business Natural Languages:

http://bnl.jayfields.com/01_introduction.html

>
> instead?
>
>
> If that's not enough to turn you on, look at how well it works with
> mocking/stubbing in places like RSpec and Mocha (http://
> mocha.rubyforge.org/examples/mocha.html).
>
> --
> -yossef
>
>
>