some thoughts on panama/jextract
Michael Zucchi
notzed at gmail.com
Mon Jan 13 00:53:48 UTC 2020
On 10/1/20 9:10 pm, Maurizio Cimadamore wrote:
>
> The point I'm making is about what the default should be. I think
> there's no question that, at the expressiveness level, you can make
> things to work in the current scheme. The only real question here is
> one: should pointers returned by native libraries be de-referenceable
> by default or not?
I don't see how that's the only real question, and honestly I don't see
how it's even a question in the first place. C support simply requires
both and which is used in any case is *explicitly defined by the API
you're accessing*. Thus in the context of "calling C functions", having
one way or another as a "default" doesn't have any meaning because there
is simply no such default in C. C relies on both being available to be
able to efficiently do useful work and there are technical trade-offs
when using either approach.
Therefore any 'default' is not technical but political and the purpose
seems to be to:
1. Inform the binding-developer they have to be extra careful and that
they're using a 'bad' library (according to some specific but
ultimately arbitrary definition of 'bad'); and
2. Inform the binding-user-developer they are using something
potentially dangerous or 'unsafe'.
But 1 is mostly meaningless and anyway redundant - and frankly
insulting, and 2 is actively misleading as i demonstrated with the
memcpy example.
And you keep using loaded language like 'ill behaved' for one of the
cases. But this title is simply not true at face value in a technical
sense and comes across as politically charged passive-aggressive
framing. Such language is neither helpful nor necessary.
I have less time to look at this now i'm back at work but will continue
my experiments* and report on them, and will follow the project to see
what you guys come up with. From past experience i'm pretty confident
you'll come up with a decent solution in the end. But it's interesting
to see the process in motion and perhaps contribute to its shaping
rather than just passively consume the results as I typically do.
Regards,
Michael
[*] This is primarily a deep deep 30+ year hobby for me that i've
basically dedicated/wasted my life to/on. While I use most things I
learn for work and I learnt a great deal from my hobby in order to do
that better, my personal driver is honing the craft of turning a cpu
into an efficient and useful tool. I have a lot of free time that I
often spend on all sorts of obtuse details, it's my main source of
entertainment and its typically about the journey and not the destination.
But debating is definitely not one of the things I enjoy spending my
time on!
More information about the panama-dev
mailing list