<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1498" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I have a need to evaluate code snippets, kind of a
scripting language, and I'm not sure what is the best way to do it.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>The snippets are defining and using common
variables, but I need to keep them separate (as opposed to compiling the whole
file into a module, like for example .yaws files).</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I see two alternatives:</FONT></DIV>
<DIV><FONT face=Arial size=2> - save the source and evaluate
it using erl_eval, and keeping the variable bindings global</FONT></DIV>
<DIV><FONT face=Arial size=2> - "bake" them inside a template
function that will take care of the bindings.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I would prefer the second approach, because the
snippets will be called many times, but I have a problem: is there a way to
retrieve the set of current bindings? I couldn't find anything, and I 'm not
even sure it is possible to add such a BIF without confusing the compiler, but I
thought I'd ask anyway because maybe some other idea might come up.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Thanks in advance! Regards,</FONT></DIV>
<DIV><FONT face=Arial size=2>Vlad</FONT></DIV>
<DIV> </DIV></BODY></HTML>