public inbox for [email protected]  
help / color / mirror / Atom feed
From: Chapman Flack <[email protected]>
To: Kartik Ohri <[email protected]>
Cc: [email protected]
Subject: Re: the ScriptingMojo
Date: Sat, 22 Aug 2020 17:55:09 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAASLQ4MBWQeFLdAPNcsgcpLyekU5X=ExQUuGgE49AUFdEYJr8g@mail.gmail.com>
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]>
	<CAASLQ4MBWQeFLdAPNcsgcpLyekU5X=ExQUuGgE49AUFdEYJr8g@mail.gmail.com>

On 08/22/20 15:12, Kartik Ohri wrote:

> I really like this idea. But I am not sure how to work this out. The main
> point of contention is the class type of platforms["Linux"]. I tested with
> Nashorn and Graal and printed the class of the object in the constructor.
> For nashorn, it is jdk.nashorn.api.scripting.ScriptObjectMirror and for
> graal it is com.oracle.truffle.polyglot.PolyglotMap.

If I do the attached, it does what I was hoping for. The constructor prints

PGXS impl class is
jdk.nashorn.javaadapters.org_postgresql_pljava_pgxs_PGXSUtils$PGXS

in nashorn, or

PGXS impl class is org.postgresql.pljava.pgxs.PGXSUtils$PGXS$$JSJavaAdapter

in graal. (Wow, pretty sneaky, Graal fakes up a class that is even in
the superclass's package! I bet it's using MethodHandles.Lookup.defineClass,
which appeared in Java 9 so Nashorn probably doesn't.)

The new Foo(jsobject) syntax only has magic if Foo is an interface or an
abstract class. If Foo is an instantiable class, that will be parsed as
simply calling a one-argument constructor to instantiate it, and passing
the jsobject as the argument. Maybe that is what you were seeing?

You sort of have to believe with this stuff; ask too many questions and
you drive the magic away.

Regards,
-Chap


Attachments:

  [image/x-coreldrawpattern] pgxs.pat (1021B, ../[email protected]/2-pgxs.pat)
  download | view image

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: <[email protected]>

* 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