I must say I really like parameterized modules but I think the
convention for passing in the "object" as the last parameter for its
"methods" is strange. In ErlyDB as in other APIs the last parameters
of a function are often optional for overriding default behavior. It's
unintuitive for me to pass the most important/consistent parameter
last when I don't use parameterized module style invocation. I'm not
saying we shouldn't use this convention in ErlyDB because I do like
being able to write e.g. 'Person:name("dan")' instead of
'person:name(Person, "dan")' but I wish this language feature were
done differently...Yariv On Sun, Jun 8, 2008 at 12:38 PM, Mikael Karlsson <[EMAIL PROTECTED]> wrote: > If you proceed with on the parameterized module track you should be aware > that it is a not "officially supported feature" of OTP and I believe it is > in OTP since the R12B release and not before. Your observation concerning > tagging the first atom as the module could be extended to that the same > thing is done for records - their names are the first atom of the tuple - so > you can have a dual view of an "object" either as a record or as a > parameterized module. One thing to consider could for instance be the > yaws_headers.erl module in erlyweb. > /Mikael > > 2008/6/7 Dan Bravender <[EMAIL PROTECTED]>: >> >> I just noticed this the other day while playing around with erlydb and >> I was really confused when it worked. Glad that someone figured out >> what's going on. It seems like quite a coincidence that the first atom >> in the tuple was the module name which is what the Erlang idiom for OO >> would require. Then again, tagging the module/type at the beginning of >> the tuple feels like the right thing to do (it has to go somewhere, >> right?) and it makes a ton of sense that this idiom exists. Really >> cool. >> >> I was sure that you had set up erlydb to work this way by design ;-). >> >> In the end it would lead to much cleaner code, so I'm all for >> reordering the parameters in the other functions. >> >> Dan >> >> PS >> >> Yariv, >> Let me know if you don't have time. I can tackle that and it would >> help me get up to speed on erlydb. >> >> On May 26, 7:34 pm, "Mikael Karlsson" <[EMAIL PROTECTED]> wrote: >> > 2008/5/26, Yariv Sadan <[EMAIL PROTECTED]>: >> > >> > >> > >> > > Hi, >> > >> > > I recently discovered in Erlang the capability to do OO-style method >> > > dispatch. It's pretty neat. I had no idea it worked but it does. >> > >> > ..... >> > >> > Hi, >> > >> > for those interested; there are som papers on this topic, called >> > parameterized modules: >> > Inheritance in >> > erlang:http://www.erlang.se/euc/07/papers/1700Carlsson.pdf >> > Parameterized modules in >> > Erlang:http://www.erlang.se/workshop/2003/paper/p29-carlsson.pdf >> > >> > Mikael >> > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "erlyweb" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en -~----------~----~----~----~------~----~------~--~---
