Re: the ScriptingMojo

From: Kartik Ohri <kartikohri13(at)gmail(dot)com>
To: Chapman Flack <chap(at)anastigmatix(dot)net>
Cc: pljava-dev(at)lists(dot)postgresql(dot)org
Subject: Re: the ScriptingMojo
Date: 2020-08-22 10:15:01
Message-ID: CAASLQ4NGoruXs1+fNsXnsic7cRjqceJ-PiYofG-OMPUWnxDjWA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

>
> - I was thinking of simplifying the parameters to processBuilder, to not
> need the caller to separately pass the command string and a list of the
> rest of the arguments. An idea that just hit me was why not just
> processBuilder(Consumer<List<String>>)? A script could use it like:
>
> var pb = processBuilder(function(l) {
> l.add(command);
> l.addAll(stuff);
> l.add(thing);
> ...
> });
>
> so the script would avoid the messiness of allocating its own ArrayList
> and so on. On the Java side that's just
>
> pb = new ProcessBuilder();
> callback.accept(pb.command());
> ...
> return pb;
>

Hi!
I am working adding these changes but I am particularly stuck at this one.
It seems that Nashorn and Graal do not support SAM inside SAM or I am doing
this the wrong way. Please see https://www.ideone.com/cQVGuB and
https://www.ideone.com/1x7Ah7. The former one fails at runtime but the
latter completes execution. (Here I have done a Consumer<Function, ?>
whereas Function<Consumer, ?> will be required for our use case, but both
fail at runtime anyways). This is the commit (
https://github.com/amCap1712/pljava/commit/136a8e879951432ec47faeb74e2a86e848481e67)
with changes that fails. I have been able to work around the issue using
the approach here
https://github.com/amCap1712/pljava/commit/d5977c5cf386758fb2d9e56524b05f9549cefe31
.

Regards,
Kartik

In response to

Responses

Browse pljava-dev by date

  From Date Subject
Next Message Kartik Ohri 2020-08-22 19:12:04 Re: the ScriptingMojo
Previous Message Chapman Flack 2020-08-21 03:28:01 Re: ScriptingMojo Custom Packaging