tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: about langage neutral



On Wed, 9 Mar 2022 14:40:44 +0000
"Koning, Paul" <Paul.Koning%dell.com@localhost> wrote:

> > On Mar 9, 2022, at 5:18 AM, jobol%nonadev.net@localhost wrote:
> > 
> > Hello tech-kern,
> > 
> > I'm discorvering the article about language-neutral-interfaces for
> > system calls.
> > 
> > https://urldefense.com/v3/__http://wiki.netbsd.org/projects/project/language-neutral-interfaces/__;!!LpKI!yl7D58zoWsSSbdJtiN2wy-TFHG_ZBOOxRhDgtdG8Eu3oECNsxINMFjwJ6qB-m9C4$
> > [wiki[.]netbsd[.]org]
> > 
> > That is a very interesting topic.
> > 
> > IMHO scheme language is well suited to answer the issue.
> > 
> > Are you interested in more discussion around that topic?  
> 
> Isn't this what SWIG tries to do?  One might argue about how well it
> does it.  As for Scheme, I thought that's a programming language, and
> a rather exotic one at that.  Or do you mean something else called
> "scheme"?

Hi Paul,


The article says:

"Declaring these interfaces in some other form, presumably some kind of
interface description language intended for the purpose, and then
generating the corresponding C declarations from that form, solves some
of these problems."

So we are really speaking about that. I know what SWIG is and it is not
the solution here.

I was recently working on IDL for the purpose of my job. There are many
IDLs. I can browse here a minimal list:

 - IDL from XDR [1], simple and smart
 - IDL from OMG [2], fat C++ affair,
 - IDL from flatbuffer [3], message passing
 - IDL from MACH/HURD (/darwin), no references, blur

None of them were fully fitting all of our dreamed requirements:
synchronous/asynchronous, contract, hidden state machine for proofs,
example of scenarios for testing. (*)

The programming language SCHEME is a programming language,
perhaps "exotic" but with the following property of interest: it can
extend itself (using high level syntax definition) (**). You can see it
like being macro.

This can be used to create structure describing the API in a convenient
way.

What I have in mind is that there is no need for a specific IDL: the
language itself is the IDL and the code generator.

I can add that SCHEME interpreters are small piece of code (that you
don't have to change, pick it and use it). Compilers also exist.

If you have a pointer to some API for discussing for real on what is
possible, with example.

Best regards
José

[1] https://www.rfc-editor.org/rfc/rfc4506
[2] https://www.omg.org/spec/IDL/4.2/About-IDL/
[3]
https://google.github.io/flatbuffers/flatbuffers_guide_writing_schema.html
[4]
https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/compiler/plugin.proto


(*) But we went with flatbuffer because it fits our purpose, it is
nice and well done and it's hype and trendy (*).

But before choosing flatbuffer, I made some experiment in generating
code with protobuf (similar to flatbuffer but fat). The default
protobuf compiler accepts plugins for generation. The protocol between
the plugin and the compiler are protobuf messages described by a
protobuf idl [4]. I generated code for writing plugins in various
languages: C++, python, scheme (and with nanopb for C).

This showed that SCHEME the language has really good qualities for
describing messages with compactness.

(**) Most languages of the LISP family have the same property. Rust
also has that feature.



Home | Main Index | Thread Index | Old Index