On Sat, 22 Dec 2007 14:55:44 +0200, Peter Verswyvelen <[EMAIL PROTECTED]>
wrote:
Before I knew Haskell, the OO community started to embrace the concept
of "interfaces" more and more (aka purely abstract classes). Furthermore
in OO, many bugs are caused IMO by keeping track of mutable state and
caches (which is often premature optimization). So for complicated
tasks, I tended to use more and more immutable objects, e.g. objects
that could be constructed once, but not mutated. And then I noticed that
it was often not needed to precompute all the values that got passed to
the constructor, so I added C# "properties" that computed the inner
cached values once, lazily.
Lazy constant in C:
int C1 (){
return 7;
}
C1 is computed only when you apply the operator () to it.
IMO Haskell embraces the above ideas and much more, with the difference
it encapsulates these ideas nicely and concisely, so you need only a
fraction of the lines of code :)
This is why we have syntactic sugar :)
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe