From: Roedy Green on
On Sat, 03 Oct 2009 21:34:46 -0400, Joshua Cranmer
<Pidgeot18(a)verizon.invalid> wrote, quoted or indirectly quoted someone
who said :

>Container<?> stores /something/, but we don't know what.
>Since Container<A> stores objects of type `A', it stores objects of any
>type, so it is a subtype of (and thus convertible to) Container<?>.

This does not seem right. What did you mean?

I think you might have meant this:

Since Container<?> stores objects of any type, in particular it stores
objects of type 'A'. Thus Container<A> is a subtype of (and thus
convertible to) Container<?>.

I have formatted, slightly edited and posted your explanation at
http://mindprod.com/jgloss/generics.html#BOUNDS
--
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
On Mon, 5 Oct 2009, RedGrittyBrick wrote:

> Lew wrote:
>> Joshua Cranmer wrote:
>>>> What syntax would you use then?
>>
>> RedGrittyBrick wrote:
>>> List of Integer
>>
>> It was hard enough achieving compatibility with the introduction of 'enum'
>> as a keyword. We don't want to be introducing COBOLish syntax through new
>> keywords if we can avoid it.
>
> Thats it! I'm taking you off my mailing list of JOBOL announcements. So
> there!
>
> Hmm,
> private Map of something that extends Integer and a List of something;

Under ECMA standard COBOJ, that should actually be:

private Map of something that extends Integer and a List of something else;

tom

--
Yulava? Niob Yam!
From: Joshua Cranmer on
On 10/05/2009 10:52 AM, Roedy Green wrote:
> What did you mean by "a container stores its type?" just that you can
> put an A into a Container<A>?

Yes.

--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth
From: Joshua Cranmer on
On 10/05/2009 12:33 PM, Roedy Green wrote:
> 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.

I keep forgetting that it's defined as Comparable<T>, not Comparable<T
extends Comparable<T>>. Enum is actually defined recursively; Comparable
is just typically used in such a manner. I had also planned to motivate
<? super T> (with the canonical example for such bounds, <T extends
Comparable<? super T>>) here, but changed my mind later.

--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth
From: Tom Anderson on
On Mon, 5 Oct 2009, Lew wrote:

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

In this post:

http://groups.google.co.uk/group/comp.lang.java.programmer/msg/927e21d3c341dd09?hl=en

I wrote:

In python, in particular, there's a possible closure syntax that is an
incredibly natural extension of the current function syntax. So where we
write functions:

def foo(a, b): return a + b

We might write closures:

foo = def(a, b): return a + b

In his reply, Joshua trimmed from "In python" to just before "We might".
Anyone who was, for some inexplicable reason, not following our every word
with rapt and studious attention would have been thrown off the scent
there.

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

For my next trick, i will conceal an exegesis about FORTRAN somewhere in
the next month's posts.

tom

--
Yulava? Niob Yam!