<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi,<br>
<br>
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 gen_server.<br>
<br>
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.<br>
<br>
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?<br>
<br>
So the idea would be to write a my_server.idl file and from that
generate two files:<br>
<ul>
<li>my_server_stub.erl</li>
<ul>
<li>This holds all the public APIs that clients may call.</li>
<li>It calls my_server_skeleton as dictated by the IDL file.<br>
</li>
</ul>
<li>my_server_skeleton.erl</li>
<ul>
<li>gets all all the calls from the my_server_stub and calls
my_server.erl</li>
</ul>
</ul>
<p>The job then is to implement my_server.erl according to the type
specs derived from the IDL file.<br>
</p>
<p>Has anyone looked into this before?<br>
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.<br>
</p>
<p>Cheers,<br>
Torben<br>
</p>
<pre class="moz-signature" cols="72">--
<a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/torbenhoffmann">http://www.linkedin.com/in/torbenhoffmann</a></pre>
</body>
</html>