dynamic built fun and records

Ulf Wiger ulf.wiger@REDACTED
Sun Oct 10 18:32:15 CEST 2004


I can see two options:

- Use epp for pre-processing. This will be a bit
   more complex, but then you can pass record definitions
   as well.
- The OTP R10 shell is supposed to understand records.
   Perhaps you could check the code and see if you
   can steal something? I haven't looked at it much,
   but it seems to involve some use of the undocumented
   module sys_pre_expand (in the compiler application.)

/Uffe

On Fri, 8 Oct 2004 07:45:48 -0700 (PDT), Knut Bakke <knutbakke@REDACTED>  
wrote:

> Hi,
> I'm building funs runtime on R9B from pure text
> strings using the following approach:
>
> {ok,Tokens,Start}=
>     erl_scan:string("fun()->testing, A=#rec{} end."),
> {ok,ExprList}=erl_parse:parse_exprs(Tokens),
> {value,Fun,_}=erl_eval:exprs(ExprList,[]}.
>
> Fun(). resuts in 'undef_record', If I remove the
> record
> the fun it works works.
>
> I'm making the fun in a module that knows about #rec.
>
> Any idea?
>
> knut Bakke.
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com



-- 
Ulf Wiger




More information about the erlang-questions mailing list