Re: Closures versus objects

Mike Newhall <[email protected]>
Newsgroups gmane.comp.lang.lightweight
Message-ID <[email protected]>
At 01:27 PM 2/17/2007 -0800, you wrote:
>What might be separate issues? To be clear, I didn't say you couldn't  
>do dynamic dispatch with functions (I specifically said you could)  
>but at the cost of having two different semantics (static and  
>dynamic) and the result feeling like one language implemented on top  
>of another. If the semantics are always dynamic (and types are  
>mutable), then the only difference AFAICS is syntax.
>
>- Steve


	What I mean is, the problem in your second example is not caused by closures or using functions, but by the lack of generic functions.  So, addressing your original comment:

"The big difference for me is purity - a pure object system has  
consistent semantics while a system based on first-class functions  
ends up having both functions and object-like-things built with  
functions. And that non-pure dynamic object code has type  
dependencies, which are at odds with code reuse and flexibility."

	It seems that with the addition of generics, a system can be built purely with first-class functions, and thus purely with one consistent semantics, and without type dependencies, which is consistent with code reuse and flexibility.  In other words, all objections seem to go away in the genericful world, though they may be valid points in the genericless world.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.