Re: Java's anonymous inner classes

2008-04-10 Thread Marco Von Ballmoos
On Apr 9, 2008, at 22:05, Peter da Silva wrote: On 2008-04-09, at 14:34, Aristotle Pagaltzis wrote: Well, the problem is, if you're willing to risk that, you can just do the job without generics -- just use a regular container and cast when you take an object out of it, the way you used to do

Re: Java's anonymous inner classes

2008-04-09 Thread Michael Poole
Marco Von Ballmoos writes: On Apr 7, 2008, at 09:28, Yossi Kreinin wrote: I would argue that more people would intuitively think that IListB inherits from IListA if B inherits from A than that it does not (and that generic methods are instead required). I think that the only reasonable

Re: Java's anonymous inner classes

2008-04-09 Thread Marco Von Ballmoos
On Apr 9, 2008, at 03:06, Michael Poole wrote: I agree with the test of can I substitute Y objects whenever X objects are used?, but I don't follow -- in your example -- under which circumstances I would be unable to substitute IListB wherever IListA is expected. Suppose you receive an IListA

Re: Java's anonymous inner classes

2008-04-09 Thread Aristotle Pagaltzis
* Marco Von Ballmoos mvonbal...@gmail.com [2008-04-09 21:05]: I would, however, be willing to accept the risk in exchange for the increase in expressiveness. Well, the problem is, if you're willing to risk that, you can just do the job without generics -- just use a regular container and cast

Re: Java's anonymous inner classes

2008-04-09 Thread Peter da Silva
On 2008-04-09, at 14:34, Aristotle Pagaltzis wrote: Well, the problem is, if you're willing to risk that, you can just do the job without generics -- just use a regular container and cast when you take an object out of it, the way you used to do before generics were added. But that means that

Re: Java's anonymous inner classes

2008-04-09 Thread David Cantrell
On Tue, Apr 08, 2008 at 09:36:21PM +0200, Marco Von Ballmoos wrote: On Apr 7, 2008, at 09:28, Yossi Kreinin wrote: I think that the only reasonable test for is Y a subclass of X? is can I substitute Y objects whenever X objects are used?. I agree with the test of can I substitute Y objects

Re: Java's anonymous inner classes

2008-04-09 Thread Marco Von Ballmoos
On Apr 9, 2008, at 13:51, David Cantrell wrote: On Tue, Apr 08, 2008 at 09:36:21PM +0200, Marco Von Ballmoos wrote: Consider this: a GothMusic is-a ModernMusic is-a Music Music defines a few methods, including getmood() which throws an exception if you haven't already setmood().

Re: Java's anonymous inner classes

2008-04-07 Thread Marco Von Ballmoos
On Apr 5, 2008, at 23:25, Aristotle Pagaltzis wrote: * Marco Von Ballmoos mvonbal...@gmail.com [2008-04-05 00:10]: C#'s generics are better, but still forbid covariance Have to, to ensure type safety. Have to is a bit strong. Willing to accept the restriction on expressiveness in exchange

Re: Java's anonymous inner classes

2008-04-06 Thread Aristotle Pagaltzis
* Marco Von Ballmoos mvonbal...@gmail.com [2008-04-05 00:10]: C#'s generics are better, but still forbid covariance Have to, to ensure type safety. Regards, -- Aristotle Pagaltzis // http://plasmasturm.org/

Re: Java's anonymous inner classes

2008-04-06 Thread numien
Simon Wistow wrote: because that doesn't make sense. So what you have to do is Foo foo; try { foo = FooFactory.getFoo(); runBar(foo); } catch (SomeCommonException e) { System.err.println(Got an exception: +e); } finally {

Java's anonymous inner classes

2008-04-05 Thread Simon Wistow
So Jav allows you to have anonymous inner classes. For example this is a really easy (if ugly) way to run something asynchronously new Thread(new Runnable() { public void run() { // do some stuff } }).start(); All well and good. But there is one down side.

Re: Java's anonymous inner classes

2008-04-05 Thread Marco Von Ballmoos
On Apr 4, 2008, at 23:37, Simon Wistow wrote: So Jav allows you to have anonymous inner classes. You had me at Java language feature. I mean. Seriously. What The Fuck? All aboard for the Java bitch train! Woo-woo! I you like Java's current approach to functional programming, can I

Re: Java's anonymous inner classes

2008-04-05 Thread Peter da Silva
On 2008-04-04, at 16:59, Marco Von Ballmoos wrote: http://earthli.com/news/view_article.php?id=1436 Is this all part of the generic hate created by the decision to avoid late binding at all costs, or is there some other source of hate here?

Re: Java's anonymous inner classes

2008-04-05 Thread Marco Von Ballmoos
On Apr 5, 2008, at 01:22, Peter da Silva wrote: On 2008-04-04, at 16:59, Marco Von Ballmoos wrote: http://earthli.com/news/view_article.php?id=1436 Is this all part of the generic hate created by the decision to avoid late binding at all costs, or is there some other source of hate here?