Function chaining in Erlang -
it nice create orm active record or hibernate, should process chained queries this:
user = user:new():for_login(«stackoverflow_admin»):for_password(«1984»):load(). how can this? or that, in 1 line - or @ least similar in spirit , meaning.
maybe there preprocessing tools can in this?
although found @zxq9 answer informative, mentioning history of imitating java-like oop style in erlang helpful.
method chaining needs state , there efforts include "stateful modules" erlang:
parametrized module: proposal lets developer implement modules accept parameters , hold them module state use in functions. long ago had been added erlang experimental feature, technical board decided remove syntactic support feature in r16 because of both conceptual , practical incompatibilities caused.
tuple module: backwards compatibility parametrized module, introduced in details in chapter 8 of programming erlang (second edition), there no official documentation , still controversial feature introduces complexity , ambiguity no power in erlang way.
imitating coding style of languages different paradigms ruby , java in erlang functional language different concepts exciting no added value.
Comments
Post a Comment