[erlang-questions] module params not visible everywhere

Ulf Wiger ulf@REDACTED
Mon Mar 12 15:31:00 CET 2007

I ran into the following snag when generating code:

-module('erlhive.ulf.epp', [___Env]).

-record(epp, {file,
              macs = .erlhive_call:call_own_module
                           setelement(2,___Env,<<117, 108, 102>>)},
                          setelement(2,___Env,<<117, 108, 102>>)),

The compiler didn't accept this. Apparently, ___Env (the module parameter)
is not bound at record definition time.

I will work around this by generating getenv/1 and setenv/2 functions
(with the obvious namespace problems that follow), but I thought I'd
mention it.

It's not that I set out to specifically use the module params this way,
but the code is the result of a regular function call wrapper.

Ulf W

More information about the erlang-questions mailing list