[erlang-questions] Newbie question: function include/1 undefined

Donald Steven t6sn7gt@REDACTED
Mon Oct 3 01:37:50 CEST 2016

Thanks Richard.  I had (alas) come to that conclusion.

In c (or m4 or the like), I can include blocks of text or code quite 
freely.  In this case, primarily as a matter of aesthetics, I wanted to 
off load some repetitive initializations to a file which could be 
included at the appropriate point, with a neat % comment on the side to 
keep my head straight.  It's a big, ugly block in an otherwise elegant 
set of funs.  I guess I'm stuck with it, as I'm reluctant to make things 
too complicated by running the whole thing through m4 first before the 
erlang pre-processor.  I do wish it could be done though.  (Dare I 
suggest a modest proposal?)

On 10/2/2016 7:26 PM, Richard A. O'Keefe wrote:
> On 1/10/16 2:25 AM, Donald Steven wrote:
>> Hi all,
>> I can get '-include(' to work before the main() function, but I can't
>> get it to work *in* a function, either using a comma or a period at end.
> The syntax of Erlang does not allow this.
> An Erlang source file is a sequence of chunks each terminated by
> a full stop.
> A chunk is a function definition if it does not begin with "-";
> if it does begin with "-" it's a declaration like -module or
> -export or a preprocessor directive like -include.
> These things *cannot* be mixed.
> Can you tell us what you are trying to achieve by doing this?
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

This email has been checked for viruses by Avast antivirus software.

More information about the erlang-questions mailing list