[erlang-questions] Avoiding boilerplate code when using gen_server

Richard O'Keefe ok@REDACTED
Wed Mar 21 23:53:47 CET 2012

On 22/03/2012, at 12:48 AM, Torben Hoffmann wrote:
> The question was: why don't you use an IDL (Interface Definition Language) approach instead of writing all that code that has to match up in order to work?
> <snip>
> I have tried searching for it, but since IDL is so tightly coupled with CORBA I didn't really find anything but the ic application from the Erlang/OTP distribution.\

There are two very different concepts here.
(1) "An interface definition language *APPROACH*."

CORBA IDL is language independent as long as the language you are pretending
to be independent of is C++ or a close relative.  It is about as bad a fit
for Erlang data structures as you would expect it to be.  This is not to say
that Erlang cannot handle the data structures passed through a CORBA interface.
It can.  What I am saying is that CORBA doesn't handle Erlang data structures.

CORBA IDL is by no means the only, nor by a very long time the first,
interface definition language, not even if we are talking about interfaces
for distributed programming.  The first time I used remote procedure call was
on a Xerox 1108 running Interlisp...

There's no reason why some sort of "little language" for specifying gen_server
stuff could not be devised.  It might even be something that could be plugged
in using a parse transform.

But step 1 is to be very very clear about what is repetitive and what is not.

Step 2 is to consider whether it can be done using higher-order functions.

More information about the erlang-questions mailing list