programming tip: a note on encapsulation

zambal zambal@REDACTED
Thu Nov 19 09:28:57 CET 2009


On 19 nov, 08:59, Joe Armstrong <erl...@REDACTED> wrote:
<snip>
> Then I can say
>
>    F = make_my_thing(...)
>    F(f1)(a, b)
>    F(data) ...
</snip>

Unfortunately F(f1)(a, b) doesn't parse. The only way to make that
work is to write it as (F(f1))(a, b), which is horrible to read. I
used to experiment a lot with using funs as kind of objects in Erlang,
but in the end I always stopped using these techniques because of this
superficial notation thing. Would it be difficult to change the parser
rules to make a call like F(f1)(a, b) valid, or would that conflict
too much with other (scoping) rules?

-
vincent


More information about the erlang-questions mailing list