[erlang-questions] JavaScript compiler for Erlang

David Mercer <>
Tue Jul 17 16:46:32 CEST 2007


Also, how would you handle garbage collection of the Javascript objects?

DBM

-----Original Message-----
From: David Mercer [mailto:] 
Sent: Monday, July 16, 2007 09:40
To: ''
Subject: RE: [erlang-questions] JavaScript compiler for Erlang

Joe Armstrong wrote:
> The difficulty of wring an interpretor seems mainly to do with getting
> an accurate
> parse tree of the js source into Erlang - the interpretor should be pretty
easy.

So, for me, who is new to Erlang and thought about it on my drive home last
Friday, is this the right approach to the implementation: have a separate
process for each object and lexical environment.  An object is then
represented as a PID, and requests for properties and methods (which are
basically the same in Javascript), would send a message to the process,
which would return the appropriate value (which may also be an object/PID)
or function.  Nested lexical environments (e.g., with blocks, function
blocks, and the global environment), therefore, can send forward a request
to their higher level if the value is not found in their environment.

Am I on the right track?

Cheers,

David




More information about the erlang-questions mailing list