Parse Transform Question

Vlad Dumitrescu vlad_dumitrescu@REDACTED
Thu Mar 9 10:55:34 CET 2006


> -----Original Message-----
> From: owner-erlang-questions@REDACTED 
> [mailto:owner-erlang-questions@REDACTED] On Behalf Of Pete Kazmier

> Can I use a parse transform to take code that looks like this:
>     test() ->
>         cond
>             predicate1() -> do1();
>             predicate2() -> do2();
>             predicate3() -> do3()
>         end.

No, you can't. This is because in order to be able to apply a parse
treansform, the original code must be syntactically valid Erlang code, and
the cond construct isn't. 

Also, cond is now a reserved keyword, and a cond construct is coming soon in
a release near you.

You could write something like
	test() ->
            	fun(predicate1()) -> do1();
              	   (predicate2()) -> do2();
            	   (predicate3()) -> do3()
and use a parse transform for this one.

Best regards,

More information about the erlang-questions mailing list