Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kAg9Z-0006Qu-P4 for pljava-dev@arkaria.postgresql.org; Tue, 25 Aug 2020 21:06:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kAg9Y-0007WY-Oi for pljava-dev@arkaria.postgresql.org; Tue, 25 Aug 2020 21:06:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kAg9Y-0007Qo-Fr for pljava-dev@lists.postgresql.org; Tue, 25 Aug 2020 21:06:48 +0000 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kAg9W-0008EM-7w for pljava-dev@lists.postgresql.org; Tue, 25 Aug 2020 21:06:47 +0000 Received: by mail-ej1-x62a.google.com with SMTP id a26so18415924ejc.2 for ; Tue, 25 Aug 2020 14:06:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=qFVkVDYijBlwlQYMhD492g8xTZawg6r2ucV8jyOghYo=; b=PIkRm3C63QQKdgoOZRxyOOml1DMpsENLvSbKku/AXE0ZG1awtSOMp95knKQhHyVsOs PRTDeCyprxt36khzJxzGumverqGxPa3N4uTCW4CchwYXLwbYfJDtzmXXLoVCdHAQlY66 8gP8pkV4X515bl+/K0vTBIGcdSRSTP5STvQbOROFNoAv+07SpfKmZ1DqrbubQYu0HboN yovjm7M8oWfI3YDEuuXc+elpWVuk34ko9yD+h5qfW9OY46zq05X2Fx5DHRlxT8LAi1HM vW9hl5LQD/bcrGaw2IuPIu78MLd7mRmZx/Ahz+fxaytJp4PGGDNz9A0VXGrGn+f7TNb+ uzVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=qFVkVDYijBlwlQYMhD492g8xTZawg6r2ucV8jyOghYo=; b=T1vnlSJcFGs+X+YI+ZlGJWXMANRCwn6V+cfwbfppvZf3aUVqPcAslBW6DijFrVlPTg 5KS96AQA4ZXX/Uh9WayUdiXcZ9COvsAqF8It12eZ2JEMu5pIm7RP24eC7iNwFOqu05VU tXv3+TjiNqJkHnCxNhQM2OxbSslfX/WUVIrWqp8VMKf28kScrbst4EgkiWMsQYV370+S Vw3sfYWvJ+NZvg/kFx5DA17TJIUHKB4v9ZUlS0H4Hp0T5iYiRGQfyh0v/6TfJ+R+o2Lq P7tKzAnsUS/JY5BXM5o3HmIKEVQNoiT3NgFI/QNEC0MgGHcPmqjDPen7Ki5viPzDn8hz vTSw== X-Gm-Message-State: AOAM532p+eoGZcT6D3esooXVXap3P8BxdqpzzqnrqkPvPCc67paOQAOY ddWQ+wUkYjiEdjBd+Uk8uFY2D8ay82IYM20e/6tx5ZT3lVs= X-Google-Smtp-Source: ABdhPJyVPv+s/DlKOe9PT5NBJU7m4WbyzAz1lX3ahOGKcAPhCMUPByK+Ik1oO0vV538k90cWmHcxLATk2Rq8kn8Q7IM= X-Received: by 2002:a17:906:91c8:: with SMTP id b8mr2886834ejx.103.1598389605179; Tue, 25 Aug 2020 14:06:45 -0700 (PDT) MIME-Version: 1.0 References: <5F368380.9070203@anastigmatix.net> <5F368A99.6070709@anastigmatix.net> <5F36965C.60707@anastigmatix.net> <5F3A7DC6.8090905@anastigmatix.net> <5F3D32E9.80504@anastigmatix.net> <5F3D36BE.70703@anastigmatix.net> <5F3D38F8.7050907@anastigmatix.net> <5F3D3A75.5010304@anastigmatix.net> <5F3D3D2E.4070109@anastigmatix.net> <5F3D43BD.4020900@anastigmatix.net> <5F3DA48D.7090408@anastigmatix.net> <5F41943D.9080707@anastigmatix.net> <5F427604.5010103@anastigmatix.net> <5F42A71F.8000002@anastigmatix.net> In-Reply-To: <5F42A71F.8000002@anastigmatix.net> From: Kartik Ohri Date: Wed, 26 Aug 2020 02:36:33 +0530 Message-ID: Subject: Re: the ScriptingMojo To: Chapman Flack Cc: pljava-dev@lists.postgresql.org Content-Type: multipart/alternative; boundary="000000000000a1248205adba1475" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --000000000000a1248205adba1475 Content-Type: text/plain; charset="UTF-8" Hi! > - I don't think formatDefines and formatIncludes make good PGXSUtils > methods. The syntax could vary across compilers (might it use /D or /I > on a Windows compiler, for example?). So I think they make better > AbstractPGXS methods that can be overridden in the configuration. > There could be a built-in implementation in AbstractPGXS using -D and -I. > Defines should be provided as a map (key to value) and the option string > with = sign should be produced by formatting. > > Regarding this, it seems that it is not possible to invoke a method whose implementation is provided in the Java class before an object is created. (Same for default methods in an interface) So, compile itself cannot call a formatDefines if a default implementation is given using AbstractPGXS. However, formatDefines can be called separately and the value be passed to compile. So, it would need creating a define method which also decides the defines for the interface and formats them. Another way is to pass the formatDefines function as a parameter to compile. But this only works for Graal and not nashorn. I am not sure whether nashorn doesn't support it or there is some way to do it I do not know of. Thanks. Regards, Kartik --000000000000a1248205adba1475 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi!
=C2=A0
=
- I don't think forma= tDefines and formatIncludes make good PGXSUtils
=C2=A0 methods. The syntax could vary across compilers (might it use /D or = /I
=C2=A0 on a Windows compiler, for example?). So I think they make better =C2=A0 AbstractPGXS methods that can be overridden in the configuration. =C2=A0 There could be a built-in implementation in AbstractPGXS using -D an= d -I.
=C2=A0 Defines should be provided as a map (key to value) and the option st= ring
=C2=A0 with =3D sign should be produced by formatting.

Regarding this, it seems that it is not possible to i= nvoke a method whose implementation
is provided in the Java class= before an object is created. (Same for default methods in an
int= erface) So, compile itself cannot call a formatDefines if a default impleme= ntation=C2=A0is given using
AbstractPGXS. However, formatDefines = can be called separately and the value be passed to compile.
So, = it would need creating a define method which also decides the defines for t= he interface and
formats them. Another=C2=A0way is to pass the fo= rmatDefines function as a parameter to compile. But=C2=A0
this on= ly works for Graal and not nashorn. I am not sure whether nashorn doesn'= ;t support it or there is
some way to do it I do not know of.

Thanks.
Regards,
Kartik
--000000000000a1248205adba1475--