Re:Does Functional Programming Replace GoF Design Patterns?
by dangrover on Sunday November 30, 2008 @06:08PM
(#381183)
That's my point. You don't need to have a separate special construct for objects, or any kind of support for them, when you have first-class functions.
As for state information, you could just put a 'let' inside there with your variables, and call mutators on them from inside the "object"'s functions.
Hmm, I think all these Scheme-centric classes I've taken have warped my mind. I should seek therapy.
Re:Does Functional Programming Replace GoF Design Patterns?
by apgwoz on Monday December 01, 2008 @09:07AM
(#381686)
> when you have first-class functions.
This isn't enough without the ability to close over the lexical environment. See Python pre 3.0, without the dictionary/list "hacks".
Re:Does Functional Programming Replace GoF Design Patterns?
by silentbicycle on Sunday November 30, 2008 @05:02PM
(#381144)
Well, strictly speaking, they're closures.
There's a lot of overlap between objects and closures, though using one or the other will frame the problem in a slightly different way.
See also: http://people.csail.mit.edu/gregs/ll1-discuss-archive-html/m...
That only works if your functions can maintain state and if they can, well they're basically objects aren't they...