Re: operator overloading
- From: Tom Anderson <twic@xxxxxxxxxxxxxxx>
- Date: Fri, 9 May 2008 00:57:36 +0100
On Thu, 8 May 2008, Joshua Cranmer wrote:
Tom Anderson wrote:
In mine opninion things like closures only pollute language while not helping anything that couldn't be addressed without them.
Oh, surely you're kidding me? I take it this means you've never used a language with closures? One of the best things about python, one of the things that meant i never looked back when i switched to it from java, was the existence of lambda expressions, functions as first-class objects, and higher-order functions.
Bloch (I think it was him) had a presentation a while back on why closures and Java don't mix; I myself was irrevocably convinced that they were a poor idea when I saw that "return" and "return;" would mean different things under the BGGA proposal (and then some people arguing that the differences were "obvious").
Interesting. I need to look this up - Josh Bloch is a smart guy. I'm not familiar with the BGGA proposal, so i should read up on that too.
Java's a great object-oriented language; don't try to force it to become a functional one as well.
I simply don't buy that the two are non-orthogonal.
Then think that when anything is included into Java we're stuck with it FOR LIFE or until we change the language for something different.
Yes. And both closures and operator overloading are features which are well-enough understood in other languages that there is essentially no risk in adopting them in java.
As Bloch points out in his presentation, there is a high risk. It mixes with generics and autoboxing in such a way that some things that seem like they should work just plain don't and can't. There is also the great chance that you end up with a situation not unlike what happened with generics: it goes only halfway and you end up with some aggravating problems.
I really do need to read up on this!
The only counterargument i can offer is that there are plenty of other languages out there that very successfully mix object-orientation and closures etc. Saying that it wouldn't work in Java is special pleading, and i don't buy it.
I'm not saying that the BGGA proposal isn't duff. But there's a difference between one proposal being duff and the whole idea being duff.
For the first few years I ate lunch with he mathematicians. I soon found
that they were more interested in fun and games than in serious work,
so I shifted to eating with the physics table. There I stayed for a
number of years until the Nobel Prize, promotions, and offers from
other companies, removed most of the interesting people. So I shifted
to the corresponding chemistry table where I had a friend. At first I
asked what were the important problems in chemistry, then what important
problems they were working on, or problems that might lead to important
results. One day I asked, "if what they were working on was not important,
and was not likely to lead to important things, they why were they working
on them?" After that I had to eat with the engineers! -- R. W. Hamming
- Prev by Date: Re: Set and .equals() semantics
- Next by Date: Re: operator overloading
- Previous by thread: Re: operator overloading
- Next by thread: Re: operator overloading