[erlang-questions] ErlTL: A Simple Erlang Template Language

Yariv Sadan <>
Thu Oct 19 19:52:56 CEST 2006


> However, it wouldn't work if
> <%? [What, Where, Objects, Action] = Data %>
> wasn't the first line of the template.
>
> Even inserting a newline before that would result in the following error:

>
>     {error,{misplaced_top_expression,{line,2},
>                                      "<%? [What, Where,
> Objects, Action] = Data %>\r
>     "}}
>
> This error appeared for both ASCII and UTF-8 files.

Actually, this line is supposed to appear before all other lines
because it's a top level expression. Top level expressions aren't part
of the function's output, so they must appear first. Adding a newline
before it is tantamount to adding a binary expression to the output,
which means that the top level expression doesn't precede all output
expressions anymore. I could change the error to a warning, but first,
can you show me a template that absolutely requires changing the
existing error handling behavior?

Thanks,
Yariv



More information about the erlang-questions mailing list