[erlang-questions] compile module from string, containing macro definitions

Mats Cronqvist <>
Fri Mar 9 08:53:05 CET 2007


Chris Newcombe wrote:
>> Does anybody know how to get compile:forms to process -include
>> directives, or if I need to do it myself as a pre-pass?
> 
> To answer my own question, a glance at epp.erl shows that include
> files are handled there.  So I guess I'll have to duplicate the
> support.

   'fraid so. btw, i would appreciate if you feed back your improvements.

> It's a shame that the preprocessor & compiler are almost-but-not-quite
> packaged in a way that makes them usable from within applications.

   yes, it's a bit sad. the compile:forms/1 function is great, but to get from 
text to the forms is a pain.

> In my case, I'm building a web-service, and as an
> administration/support tool I'm providint a REST API to accept some
> POSTed code, compile it, load it on all nodes (incase it calls funs on
> remote nodes), and execute it.
> 
> Basically I want a scriptable version of a remote-shell.   It's
> clearly a tremendously powerful way to get visibility into, and
> control over, a live system (with appropriate care over security).
> Remote-shells are a wonderful tool, but too painful if there are lots
> of nodes.
> 
> I'm suprised that this doesn't seem to be a common pattern.

   perhaps it's because kids these days are too damn lazy to roll their own 
preprocessors :>

   mats



More information about the erlang-questions mailing list