[erlang-questions] Avoiding boilerplate code when using gen_server
Wed Mar 21 12:48:38 CET 2012
I was sitting with a co-worker - who is proficient in OCaml and lots of
other stuff and he is now learning Erlang - and then he comes up with a
good question on the amount of boilerplate code when implementing a
From the API functions you call out to gen_server:call/2 and on top of
that you need to implement a handle_call/3 function clause that matches
whatever format you used for wrapping the incoming message.
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?
So the idea would be to write a my_server.idl file and from that
generate two files:
o This holds all the public APIs that clients may call.
o It calls my_server_skeleton as dictated by the IDL file.
o gets all all the calls from the my_server_stub and calls
The job then is to implement my_server.erl according to the type specs
derived from the IDL file.
Has anyone looked into this before?
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
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions