Hi Alex,

>> > look at lines 99 through 142 of "ersatz/fun.src" (actual version),
>> > you see a lot of tedious type ('instanceof') checks. And they don't
>> > even cover all possible cases! The same would be required for the
>> > opposite direction. Or does anybody know a better way?
>
> I say that the above code is a mess because it still has to check for
> each possible type and take the appropriate action. As you can see, it
> covers bytes, characters, integers, longs, doubles, bigIntegers,
> strings, objects, byte arrays, char arrays, int arrays, long arrays and
> double arrays. Other types, like short integers, or string arrays etc.
> are not covered (and I hope they are not such important). BTW, I just
> notice that booleans (and boolean arrays) are also missig; booleans
> might be needed.
>
> I cannot see a generic way to do that.

I haven't looked at your code, but you might have a look at wl
interpreter we discussed some time ago.  The java ffi was quite complete
and quite generic and more importantly, completely automatic, althought
not the fastest due to relying on reflection completely.  There is code
for finding the right method and constructor with matching prototypes
and something similar for fields to get and set them IIRC.

Cheers,

Tomas

-- 
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe

Reply via email to