On 23/01/11 01:51, Volker Grabsch wrote:
> William S Fulton schrieb:
>> On 10/01/11 09:09, Volker Grabsch wrote:
>>> Anyway, I just changed my code back to its original style, using
>>> two macros, one for the common case and one for the primitive types:
>>> SWIG_STD_VECTOR_ENHANCED_PRIMITIVE(bool, Boolean)
>> In my original reply, I was hoping you'd use the approach used in the C#
>> version, where you provide template specializations of std::vector for
>> the primitive types.
> In what important points does my solution differ from the
> C# version? I thought I did follow that approach as closely
> as possible - at least I tried to.
>> If you can provide a java version of
>> li_std_vector_runme.cs, I'd consider this job done
> I'm not sure whether I really understand you here.
> There already exists a li_std_vector_runme.java program.
> Also, a direct tranlation of li_std_vector_runme.cs to Java
> is in most points simply impossible, because C#'s and Java's
> Vector APIs are quite different.
> So I just added some more test code li_std_vector_runme.java
> for checking the iterator extension, and added some other
> tests which I felt were missing:
> I also added support for the pointer types:
>> but I think there is
>> a chunk of missing functionality, for example, I'd expect a good
>> implementation to implement the Collection<> and List<> interfaces.
> Note that your request is equivalent to simply demanding the List<>
> interface, because Collection<> and Iterable<> are superinterfaces
> of List<>.
> And although I fully agree that full List<> support would be nice,
> I don't have the time to do that. This interface is quite big,
> and there are no helper mechanisms that handle complex methods
> like subList() for standard cases.
> Even worse, the already existing methods set(), add() etc. of
> SWIG aren't compliant to the List<> interface, either. So I
> went ahead and solved at least that issue, which turned out
> to be more complicated than expected:
> It would be great if you could include those patches #1 - #3.
> Then, implementing the List<> interface is really "just" adding
> new methods. I prepared a stub for that, to facilitate the work
> for others who like to provide the missing methods:
> Note that this patch #4 should *not* be applied to SWIG as it is,
> because it complies with the List<> interface formally but not
> sematically (every method throws an UnsupportedOperationException,
> which is only allowed for a certain subset of them).
Indeed, a lot of work is required to get the full IList<> support which
I see as the ultimate goal. But given that the interface is going to be
quite different to what is currently shipped, I would like the default
that SWIG ships either to make no change or get it completely correct
because making a non-backwards compatible change that quite possibly may
change again in the future is only going to infuriate the many users of
std::vector Java wrappers. I suggest you put these patches in the SF
tracker as a new patch so that they don't get lost on the mailing list
and hopefully someone else can pick them up and finish it off for
inclusion into the SWIG distribution.