Erlang Mailing Lists

Author Message

<  Erlang patches mailing list  ~  Patch to allow parameterized modules in parse transforms

mdempsky
Posted: Mon Nov 19, 2007 10:32 pm Reply with quote
User Joined: 24 Sep 2007 Posts: 118
The Erlang compiler does not currently allow parameterized modules to
be used for parse transforms, but only because of a bad atom_to_list
call. I replaced this with io_lib:format and it seems to work.

--- compile.erl~ 2007-10-31 07:05:39.000000000 -0700
+++ compile.erl 2007-11-19 14:12:43.000000000 -0800
@@ -765,7 +765,7 @@
end.

foldl_transform(St, [T|Ts]) ->
- Name = "transform " ++ atom_to_list(T),
+ Name = lists:flatten(io_lib:format("transform ~p", [T])),
Fun = fun(S) -> T:parse_transform(S#compile.code, S#compile.options) end,
Run = case member(time, St#compile.options) of
true -> fun run_tc/2;
_______________________________________________
erlang-patches mailing list
erlang-patches@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-patches
Post recived from mailinglist
View user's profile Send private message
Guest
Posted: Tue Nov 20, 2007 6:19 am Reply with quote
Guest
"Matthew Dempsky" <matthew@dempsky.org> writes:

> The Erlang compiler does not currently allow parameterized modules to
> be used for parse transforms, but only because of a bad atom_to_list
> call. I replaced this with io_lib:format and it seems to work.

I don't want to include this patch as there is no portable way
to use a parameterized module in a compile directive embedded in
a source file.

We might implement another solution for using parameterized modules
as parse transforms later, when/if parameterized modules have become
a support part of the language.

/Bjorn

> --- compile.erl~ 2007-10-31 07:05:39.000000000 -0700
> +++ compile.erl 2007-11-19 14:12:43.000000000 -0800
> @@ -765,7 +765,7 @@
> end.
>
> foldl_transform(St, [T|Ts]) ->
> - Name = "transform " ++ atom_to_list(T),
> + Name = lists:flatten(io_lib:format("transform ~p", [T])),
> Fun = fun(S) -> T:parse_transform(S#compile.code, S#compile.options) end,
> Run = case member(time, St#compile.options) of
> true -> fun run_tc/2;
> _______________________________________________
> erlang-patches mailing list
> erlang-patches@erlang.org
> http://www.erlang.org/mailman/listinfo/erlang-patches
>

--
Bj

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum