<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Wed, Dec 18, 2024 at 9:52 AM Maurizio Cimadamore <<a href="mailto:maurizio.cimadamore@oracle.com">maurizio.cimadamore@oracle.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>

  
  <div>
    <p>This is nice.</p>
    <p>I'd note here that we started with something similar a long time
      ago and then we saw that if the JDK provided a low-level enough
      API, it would have been possible for other parties to provdie
      higher-level story (with annotations, etc.) which seems what you
      have done here.</p>
    <p>I belive where I'm confused is here:</p>
    <blockquote type="cite">
      <div style="font-family:arial,helvetica,sans-serif"><br>
      </div>
      <div style="font-family:arial,helvetica,sans-serif">But it would be
        nice to take the idea a step farther and get rid of the
        interface altogether.</div>
    </blockquote>
    <p>What is the problem with the interface?</p>
    <p>Note that, alone, just calling via a native method won't help
      with platform dependency, as you will still need to "pick" a
      signature that is ok for _all_ platform, and adapt the method
      handle under the hood accordingly. So, in terms of "portability"
      interface vs. method is the same.</p>
    <p>In terms of usability they are also the same: an interface method
      is just a method, checked by javac (and IDEs) -- same as a native
      method.</p>
    <p>Is it startup you are worried about? If so, I agree, the cost
      model of JNI and FFM is very different, but I think we need a more
      holistic approach to address that. If my guess is incorrect,
      please expand more of why you think proxied interfaces are bad.<br></p></div></blockquote><div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">They're bad because they're a mis-fit. You end up creating a static field holding a global singleton object of a class which is the single possible implementation of the interface. That's what static methods are _for_. If I designed a whole program that way, I'd be called crazy. :-)</div><br></div><div>--</div></div><div dir="ltr" class="gmail_signature"><div dir="ltr">- DML • he/him<br></div></div></div>