Prev: Putting passwords in a properties file?
Next: Interview
From: Roedy Green on 5 Oct 2009 10:33 On Sat, 03 Oct 2009 21:34:46 -0400, Joshua Cranmer <Pidgeot18(a)verizon.invalid> wrote, quoted or indirectly quoted someone who said : >How was that? Impressive! I am going to use it in the entry to help explain generics. You did one of the things I like to see in docs, start with the simple case and gradually add the complexities. -- Roedy Green Canadian Mind Products http://mindprod.com Smart data structures and dumb code works a lot better than the other way around. ~ Eric S. Raymond The Cathedral and the Bazaar
From: Roedy Green on 5 Oct 2009 10:52 On Sat, 03 Oct 2009 21:34:46 -0400, Joshua Cranmer <Pidgeot18(a)verizon.invalid> wrote, quoted or indirectly quoted someone who said : >An important fact to realize is that subtyping of generic types isn't >quite what would be expected at first: if A is a subclass of B, >Container<A> is not a subtype of Container<B>. Remember that a container >stores it type: you can store any B into a Container<B>, so being able >to cast from Container<A> to Container<B> means you can put a B into the >Container<A>. did you mean to say there: You can store any A into a Container<A>, so if B is a subclass of A, besides an A you can also put a B into Container<A>. What did you mean by "a container stores its type?" just that you can put an A into a Container<A>? -- Roedy Green Canadian Mind Products http://mindprod.com Smart data structures and dumb code works a lot better than the other way around. ~ Eric S. Raymond The Cathedral and the Bazaar
From: Tom Anderson on 5 Oct 2009 11:05 On Sun, 4 Oct 2009, Lew wrote: > Tom Anderson wrote: >> Well: >> >> foo = lambda a, b: a + b >> is already legal! > > Not in Java it isn't. True. But since that part of the post was a digression about python, irrelevant. tom -- X is for ... EXECUTION!
From: Roedy Green on 5 Oct 2009 12:33 On Sat, 03 Oct 2009 21:34:46 -0400, Joshua Cranmer <Pidgeot18(a)verizon.invalid> wrote, quoted or indirectly quoted someone who said : >Types can also be recursive. A recursive type is something of the form >class Foo<T extends Foo<T>>. You generally subclass or implement >interfaces of these form in the fashion class Bar extends Foo<Bar>. The >purpose of a recursive type is to operate on itself in some fashion: >think of Comparable's compareTo method. Classes implementing Comparable >only compare objects of the same class as them, not of other classes >implementing Comparable. I don't understand. I looked at the definitions of Comparable and Comparator, compare, compare to, and their implementations. I saw no use of recursive types. -- Roedy Green Canadian Mind Products http://mindprod.com Smart data structures and dumb code works a lot better than the other way around. ~ Eric S. Raymond The Cathedral and the Bazaar
From: Lew on 5 Oct 2009 13:39
On Oct 5, 11:05 am, Tom Anderson <t...(a)urchin.earth.li> wrote: > On Sun, 4 Oct 2009, Lew wrote: > > Tom Anderson wrote: > >> Well: > > >> foo = lambda a, b: a + b > >> is already legal! > > > Not in Java it isn't. > > True. But since that part of the post was a digression about python, > irrelevant. That was completely unclear from the context, which was Joshua Cranmer's suggestion about a possible Java syntax. I saw nothing in either Joshua's post or yours that made it clear to me that it was about Python, even now after reviewing the relevant posts and seeing the word "Java" in that part of the discussion. But I'll take your word for it, it was a digression about Python. -- Lew |