public inbox for [email protected]
help / color / mirror / Atom feedFrom: Kartik Ohri <[email protected]>
To: Chapman Flack <[email protected]>
Cc: [email protected]
Subject: Re: the ScriptingMojo
Date: Sun, 23 Aug 2020 00:42:04 +0530
Message-ID: <CAASLQ4MBWQeFLdAPNcsgcpLyekU5X=ExQUuGgE49AUFdEYJr8g@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CAASLQ4Mva7dAXiS_c9OLhV4VzNHF=XNKJosuS5gtZTB6b4TW1Q@mail.gmail.com>
<[email protected]>
<CAASLQ4M0uvNj0EyMWWNsizT1KtnWx0WFbk89ud9EVHZbu12LMg@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]>
>
> It might be worthwhile to define an abstract class in Java that has
> the necessary methods; it could also supply some other useful methods
> or default implementations. I think the javascript could then do something
> like:
>
> var platforms = {
> 'Linux': { compile: function(...) { ... }, link: function... },
> 'Windows' : { ... },
> ...
> }
>
> var impl = new AbstractPGXS(platforms['Linux']);
>
> which would enforce that the needed methods were all present, and the
> ones supplied in Java would be naturally available too. I have not
> tried this out to make sure it does what I expect in both nashorn
> and graal.
>
Hi!
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. So, it will require
implementation based handling depending on the Script Engine. That would
probably require having both Nashorn and Graal present as dependencies or
dynamically instantiating implementations which could get messy (or we
could enforce using graal always, but I don't know if that's a good idea).
But I might be missing something or another easy way here. Also, we could
add a javascript function to examine the object runtime and throw an error
with a detailed message if something is incorrect.
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: <CAASLQ4MBWQeFLdAPNcsgcpLyekU5X=ExQUuGgE49AUFdEYJr8g@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