public inbox for [email protected]  
help / color / mirror / Atom feed
From: Kartik Ohri <[email protected]>
To: Chapman Flack <[email protected]>
Cc: [email protected]
Subject: Re: the ScriptingMojo
Date: Sun, 23 Aug 2020 01:49:08 +0530
Message-ID: <CAASLQ4NxaNzZR19dFY6CL80Yz+ntN=LGdRfsX0bOJ_aLKoM-QA@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CAASLQ4Mva7dAXiS_c9OLhV4VzNHF=XNKJosuS5gtZTB6b4TW1Q@mail.gmail.com>
	<[email protected]>
	<CAASLQ4M3pR+ZL+uPvcQ-dAEL2KdH_PGe-_pBhsjvOgN5qvf+aA@mail.gmail.com>
	<[email protected]>
	<CAASLQ4NU9v=nuLDG-LneC68LuqKRXchFckU7mCZT9YQDNKqwvg@mail.gmail.com>
	<[email protected]>
	<CAASLQ4NgH+tXbdUSA8xDh2ct3gAS3xa8V7=E0gcYd+d=m8kujw@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<CAASLQ4PEgo5Nj0EVsOfGoB96dQFXfFYxrrB0rS1wdad7x_E5fA@mail.gmail.com>
	<CAASLQ4OowXOmnbbbT0Wh1ZkB4h=6JQfC61ojmN07EYnO0QCcow@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<CAASLQ4NGoruXs1+fNsXnsic7cRjqceJ-PiYofG-OMPUWnxDjWA@mail.gmail.com>
	<[email protected]>
	<[email protected]>

On Sun, Aug 23, 2020 at 1:43 AM Chapman Flack <[email protected]> wrote:

> On 08/22/20 15:33, Chapman Flack wrote:
> > Ok, I removed the parallel() and now graal also complains about the SAM
> > cast. This puzzles me because I thought both engines were intended to
> > support that, so I'll keep playing with it a bit.
>
> If I make the attached changes, both nashorn and graal seem to be happy.
>
> It appears that, when invoking a method /of a Java object/, they
> recognize when its parameter type is a SAM interface, and do the magic
> to present a JavaScript function as an implementation of that.
>
> We might just be asking for too many layers of magic when we start by
> binding a Java lambda into the script engine (which probably wraps one
> layer of magic over it to make it look like a JS function), and then try
> to pass a JS function as a parameter needing its own magic wrapping to
> appear as a Java SAM interface, and the engine may not see through the
> first layer of magic to realize it needs to add the second.
>
> "Thing" as a class name is just proof-of-concept of course. :) I had
> been wondering earlier if it might be useful to make PGXSUtils instantiable
> and bind an instance of it into the script; its constructor could take the
> MavenProject and Log and those wouldn't have to be passed around as much.
> It would still be possible to bind selected methods of it directly with
> names of their own for convenience, but other methods could just be
> accessible as utils.method() and I think that would solve this casting
> issue.
>
> Regards,
> -Chap
>

Sounds good to me. I'll make the changes to the PGXSUtils class.
Regards,
Kartik


view thread (78+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: the ScriptingMojo
  In-Reply-To: <CAASLQ4NxaNzZR19dFY6CL80Yz+ntN=LGdRfsX0bOJ_aLKoM-QA@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox