[erlang-questions] compile transforms which change the module name

Joe Armstrong erlang@REDACTED
Fri Jul 10 15:50:19 CEST 2009

On Fri, Jul 10, 2009 at 12:52 PM, Vlad Dumitrescu<vladdu55@REDACTED> wrote:
> On Fri, Jul 10, 2009 at 12:36, Joe Armstrong<erlang@REDACTED> wrote:
>> I am making a very nice transform.
>> Hint: take all files in an application call these {x1.erl, x2.erl ...}
>> 1) Make a name map
>> 2) transform all code in x1.erl x2.erl replacing the module names x1,
>> x2 ... etc.
>>    with the MD5 sums so x1:abc(...) becomes m273...:abc( ...)
>> 3) replace apply(M,F,A) with newapply(map(),M, F, A)
> Hi Joe,
> Looks nice, but I have a few followup questions:
> - where will the map() function reside?

Somewhere :-)  (in the group leader)

> - what about M:F() calls and M:F/A references sent as data?

Will break existing code - we need a new bif    Mod1 = theModName(Mod)
which converts a module name like "lists" into the correct version "424acfe..."

> - updating a comment will invalidate the map...

Yes - I'm not sure about this. I could make a check sum from
epp:parse_file then remove the
line numbers.

If an average erlang module is 20KBytes then could fit 50,000 modules in 1GB

> - it would be nice to have tools to do the reverse transformation for
> logs and error messages; also, to be able to find the right version of
> a module in ClearCase or SVN given the name and a MD5 hash.

No need to the transformed module can have an added exported function:

    my_origonal_name() ->


> best regards,
> Vlad

More information about the erlang-questions mailing list