Re: operator overloading



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.

tom

--
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
.



Relevant Pages

  • Re: The Closure Controversy
    ... overhaul the language, fixing the fundamental problems first and, if you do ... pure functional programming cannot succeed in Java: ... But Bloch also points out that closures seek to solve several problems in Java: ...
    (comp.lang.java.programmer)
  • Re: Why we should (not?) have closures after all
    ... If this is the best argument against typedef, ... No language can force programmers to use ... The attitude of Java aficionados is often "We ... the closures proposal seems to be ...
    (comp.lang.java.programmer)
  • Re: Alternatives languages on the JVM: which one or is there no alternative?
    ... people who where opposed to adding closures in the first place. ... Java world became more receptive to the idea would have made it possible ... But Java does not only serve a role as the status quo language for the ... Unless one or some of the alternative JVM languages take over that role ...
    (comp.lang.java.programmer)
  • Re: operator overloading
    ... 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 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. ... Java's a great object-oriented language; don't try to force it to become a functional one as well. ... 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. ...
    (comp.lang.java.programmer)
  • Re: Comparing Lisp conditions to Java Exceptions
    ... All the ISO standards in the world will not make the world ... Nothing keeps you from annotating your program with exceptions based on what ... language should adhere to your theory. ... Curiously, although you don't say it, Java has the opposite problem. ...
    (comp.lang.lisp)