[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: RE: [computer-go] Chains and liberties
> -----Original Message-----
> From: computer-go-bounces@xxxxxxxxxxxxxxxxx
> [mailto:computer-go-bounces@xxxxxxxxxxxxxxxxx]On Behalf Of Petri Pitkänen
> Sent: Monday, November 15, 2004 4:36
> To: computer-go
> Subject: Re: RE: [computer-go] Chains and liberties
>
>
>
> > But
> > casts are very expensive. In Java 1.5, which I don't use yet, there are
> > type-safe collections, but I understand from the documentation it just
> > does
> > the cast under the hood. (Swept under the carpet I call that.)
> >
>
> I think you would have write your own versions. JAva ones ARE
> type safe as defined by OO jargon, but they generic, but still
> fully type safe, all objects know what they are . Hence there is
> no way aroud it. But I tought that 1.5 has templates like C++.
> That would address your problem. It was in the proposals anyway.
> As I got rid of Java recently (bacj real programming languages
> :).) I did not follow through.
Yes, with the generics, which look like templates, it's possible to make
type-safe collections. But the documentation clearly says the compiler will
generate the type-cast automatically, so no gain in terms of performance I
would guess. But it also says this generated type-cast is used when adding
objects to the collection to make sure only the right type is added. If it's
only used for adding and not for retrieving, then a little is gained, as on
average retrieval happens more often than addition. We'll have to see.
_______________________________________________
computer-go mailing list
computer-go@xxxxxxxxxxxxxxxxx
http://www.computer-go.org/mailman/listinfo/computer-go/