<p>Given that the underlying mechanism stays, and only the syntactical conveniences are under threat: to what extent can the current pmod handling be replaced by / emulated with a parse_transform?<br>
If it's possible to do it that way, that might provide the best of two worlds: the existence of the pmod feature without having the maintenance burden in the compiler.</p>
<div class="gmail_quote">Den 12/10/2012 10.04 skrev "Gleb Peregud" <<a href="mailto:gleber.p@gmail.com">gleber.p@gmail.com</a>>:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Thu, Oct 11, 2012 at 11:52 PM, Evan Miller <<a href="mailto:emmiller@gmail.com">emmiller@gmail.com</a>> wrote:<br>
> I designed BossDB around parameterized modules because pmods allow one<br>
> to develop with a familiar ORM pattern in Erlang. I wanted a<br>
> record-oriented API that was simple, succinct, and comprehensible.<br>
> With pmods I was able to succeed in these goals. For example, to<br>
> create a new record:<br>
><br>
>   Person = person:new(id, "Joe", "Armstrong")<br>
><br>
> To save it:<br>
><br>
>    case Person:save() of<br>
>        {ok, SavedPerson} -> % do something ...<br>
>        {error, ValidationErrors} -> % do something else ...<br>
>    end<br>
><br>
> To access an attribute:<br>
><br>
>    Person:first_name().<br>
>    "Joe"<br>
><br>
>    Person:last_name().<br>
>    "Armstrong"<br>
<br>
I believe that someone from OTP team mentioned that the parametrized<br>
modules are to be deleted, but tuple modules will stay. Essentially<br>
this will mean that instead of writing:<br>
<br>
-module(person, [FirstName, LastName]).<br>
-compile(export_all).<br>
first_name() -><br>
  FirstName.<br>
<br>
You will have to write:<br>
<br>
-module(person).<br>
-record(person, {first_name, last_name}).<br>
-compile(export_all).<br>
new(FirstName, LastName) -><br>
  #person{first_name = FirstName, last_name = LastName}.<br>
first_name(Person) -><br>
  Perosn#person.first_name.<br>
<br>
but you will still be able to do:<br>
<br>
   Person = person:new("Joe", "Armstrong").<br>
   Person:first_name().<br>
   "Joe"<br>
   case Person:save() of<br>
       {ok, SavedPerson} -> % do something ...<br>
       {error, ValidationErrors} -> % do something else ...<br>
   end.<br>
<br>
So from point of view of readability there will be no change,<br>
althought the amount of code in the model module (person.erl) will<br>
slightly increase.<br>
<br>
Please correct me if I am wrong.<br>
<br>
Cheers,<br>
Gleb<br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div>