[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Generics



Hi Anne,

There are lots of possibilities once we move to using generics. The reason for not including them is backwards compatibility. The current Kent JCSP version is 1.1-onwards compatible I believe, and the next version will become 1.3-onwards compatible. This is partly for using Java on mobile devices I gather - something Kevin Chalmers knows more about than me. Maintaining two versions of JCSP (a 1.5 version with generics, and an older version without) would be tricky, so we currently aim for the broadest user-base that is sensible - and that means being compatible with Java 1.3.

Neil.

Anne van Rossum wrote:
Dear list members,

This is about the Quickstone version of JCSP, but I guess it also
applies to yours. Is there a reason not to use generics?
___________________
I mean, One2OneChannel etc. do not derive from some general Channel
interface, while they all have to have a in() and out() method that
returns a ChannelInput and a ChannelOutput.

public interface Channel<I extends ChannelInput, O extends
ChannelOutput> {
    public I in();
    public O out();
}
___________________
Likewise ChannelOutput only does have one thing to carry, so it's
naturally to give the one extending the class the ability to restrict
the type of object that can be transported in the following way:

public interface ChannelOutput<O> {
  public void write (O object);
}

This can be used by extensions, although not for basic data types (like
int), e.g. in the following sense:

public interface ChannelOutputInteger extends ChannelOutput<Integer> { public void write (Integer integer);
}
___________________
I hope you see enough reasons in terms of extendibility that you
consider this option.

Kind regards,

Anne