Actually, a better answer to this question would be: it should be easy for you to create a macro that will generate the appropriate handle_call or handle_cast functions based on a record. Here is a spike (I haven't tested it, but you will have an idea):<div>
<br></div><div><a href="https://gist.github.com/fb133f91db77a9938d57">https://gist.github.com/fb133f91db77a9938d57</a></div><div><br></div><div>Feel free to ping me by e-mail if you want to go further into this. :)<br><div>
<div><br></div><div><br></div><span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse"><b><span style="border-collapse:separate;font-family:arial;font-weight:normal"><div><span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse"><b>José Valim</b></span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse"><div><span style="font-family:verdana,sans-serif;font-size:x-small"><a href="http://www.plataformatec.com.br/" style="color:rgb(42,93,176)" target="_blank">www.plataformatec.com.br</a></span></div>
<div><span style="font-family:verdana,sans-serif;font-size:x-small">Founder and Lead Developer</span></div></span></div></span></b></span><br>
<br><br><div class="gmail_quote">On Fri, May 25, 2012 at 6:19 PM, José Valim <span dir="ltr"><<a href="mailto:jose.valim@gmail.com" target="_blank">jose.valim@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Is it possible to use elixir to emulate objects on top of gen_server<br>
with their "instance variables" which are just fields of record?<br>
</blockquote></div><br></div><div>Elixir does not have the concept of objects. So you have to do the same as Erlang. You need to create a record and access/manipulate the records fields. There is a difference that Elixir records are not a preprocessor feature, so access/manipulation is less verbose.</div>
</blockquote></div><br></div></div>