[Pas2js] Next language feature for pas2js...
Michael Van Canneyt
michael at freepascal.org
Sat Apr 28 11:47:24 CEST 2018
On Sat, 28 Apr 2018, Sven Barth via Pas2js wrote:
>> You can do this in a clean way already. See e.g. Remobjects SDK. Or
>> WST, if you want open source..
> From what I can see Remobjects' Remoting SDK either requires the use of
> attributes or a definition file. WST also requires a definition file.
> The idea I want to see (and which is done by mORMot) is to rely on the
> RTTI of interfaces paired with Invoke() to do this without any
> definition files:
I know.
> end;
>
> === code end ===
>
> On the client side (at least if it's written in FPC (or Delphi)) there
[Snip]
> Currently missing for this to be done in FPC is the TVirtualInterface
> implementation as well as a working Invoke() for more platforms than
> Linux... (and of course time :P ). And yes, I'm still somewhat missing a
> concept for authorization.
I am aware of all these things.
(BTW: pas2js already has the TVirtualInterface)
Other than that, I understand what you mean and want to do.
But in my experience the use of a definition file has its benefits.
It helps when formalizing the API: it is the single source of truth.
>From it, you can generate various interfaces in different languages.
e.g. Remobjects SDK has the code-first approach as mORMot has.
It generates interfaces for other languages this by converting the API's
RTTI to their 'old' definition file (RODL), and then convert this to the
target language, thus more or less demonstrating that the definition file
is primordial anyway...
I consider the approach you describe good for quick & dirty stuff:
For quick prototyping, it's definitely useful.
but for a longer and more formalized development trajectory (the kind I am usually doing)
the gain is almost zero: I consider the benefits of the code-first approach hugely overstated.
But I am fully agreed with you that what you describe is needed, and if you
need any help or have ideas, let me know, I will certainly do what I can to
help.
Michael.
More information about the Pas2js
mailing list