views:

46

answers:

1

Can you give me an example, in PHP, that shows how closures are helpful in creating a DSL (fluent interface)?

edit: The accepted answer in the following question tells about nested closures. If someone could translate that example to PHP that would be helpful too: http://stackoverflow.com/questions/1966515/experience-with-fluent-interfaces-i-need-your-opinion

+1  A: 

I do not know PHP, but I guess you do, so maybe it would be easy for you after pointing you to this great resource: http://martinfowler.com/dslwip/Closure.html and http://martinfowler.com/dslwip/NestedClosure.html .

Gabriel Ščerbák
Thanks. I was actually reading portions of his book while I checked here for a moment. Some interesting things in there. http://martinfowler.com/dslwip/
koen
@koen if you are really interested and can spend some money, there is already a work i nprogress avalaible book in Safari bookshelf.
Gabriel Ščerbák