Re: SRAPI and std::vector
Luigi Ballabio <luigi.ballabio <at> fastwebnet.it>
2004-03-26 14:04:37 GMT
On 2004.03.22 21:08, John Lenz wrote:
>> While I would like to remove replication, I have to admin that a few
>> things in the above bother me, namely:
>> a) one is forced (just once, I admit) to write the union of all
>> instructions that are needed for each language. For example,
>> the fact that the Python API requests reference-count management
>> makes it necessary to add SWIG_Vector_DecrementRef() macro calls.
>> However, I admit this is just a very minor problem.
> In defense of the DecrementRef stuff, any language that uses
> reference counting will need to implement the DecrementRef. I don't
> really see the DecrementRef as a Python specific thing.
Well, I might have been biased by the fact that we have std::vector
typemaps for Guile, MzScheme, Perl, Python, Ruby and TCL, and Python is
the only language with reference counting :) But as I wrote, this was
a very minor point, and definitely not one that I would raise against
>> b) More serious is that I'm not really sure that one can write
>> code which is truly language-independent. The most obvious
>> example is that Scheme typemaps for std::vector now accepts
>> both Scheme vectors (random-access) and lists (single-linked).
>> For the latter, the pattern
>> for (i=0; i<size; i++)