TCL in Erlang

Shawn Pearce spearce@REDACTED
Mon Jan 15 05:32:43 CET 2001

In a sick, perverted way I want to embed a TCL runtime in the Erlang
VM so I can call TCL code from Erlang.  Or really, let Erlang define
a set of functions which the TCL engine will invoke when the Erlang
code asked the TCL engine to execute a source file.

What I have in mind is something like this:

test(FilePath) ->
	I = tcl:create(),
	tcl:register(I, "ExecuteErlang", ?MODULE, execute, undefined),
	tcl:eval(I, FilePath).

execute(Handle, CmdName, [UserName, Email | Message]) ->
	io:format("User ~p asked me to email them ~p at ~p~n.",
			  [UserName, Message, Email]).

Or something like that.

Should I make a driver that will link against the TCL library and can
be loaded, or should I make the TCL engine an external process, fork
it and connect it with a TCP stream?  Or could I make the tcl module
a set of BIFs somehow that would make it unnecessary to define a

Or since I wanted TCL soley for its syntax, am I just better off
making my own language parser in Erlang and using that process the
input file?


  ``If this had been a real
    life, you would have
    received instructions
    on where to go and what
    to do.''

More information about the erlang-questions mailing list