Using erlang as script language

Taavi Talvik taavi@REDACTED
Tue Dec 28 23:11:28 CET 2004


On Tue, 28 Dec 2004, Héctor Rivas Gándara wrote:

>
> I wonder how difficult can be integrate Erlang as script language of a XUL [1]
> render motor.
> Erlang code must be interpreted, not compiled, so records and macros should
> not be allowed.
> Actual reder motors are designed for a single thread model, so the access to
> data must be coordinated.
> And how can the UI widgets be controlled? they are usually designed to be
> accessed by imperative OO languages.
>
> What do you think about this?

You can threat XUL render motor as port program. Actually you need quite 
simple interface between erlang and XUL.

XUL server:
 	ObjectId = create_object(type)
 	[{Attr1,Val1},..] = get_attribute(ObjectId, [attribute,..]
 	set_attribute(ObjectId, [{Attr1,Val1},..}])
 	send_event(ObjectId, Event, [Attrs,..])

On erlang side you just remember all objects as tuples
 	{ObjectId, type, [{Atr1,Val1},..}

Basicly similiar to X. XUL acts as X server, erlang as client. Primitives 
are just somewhat specific.

best regards,
taavi


More information about the erlang-questions mailing list