Object-Oriented on Erlang VM

Erlang is a *super* concurrent-oriented functional language.

Here, I listed some way to write object-oriented code for erlang. (Not just some shapes trick)

1. mudole as value.

ModuleName = math,
X = ModuleName:sqrt(16.0).

Ok, it’s not OO enough.

2. build-in parameter module and extends module.

-module(super).
-export([f1/0]).
f1() -> super_f1.
%%%%%%%%%%%%%%%%%%%%%%
-module(sub).
-extends(super).

Try to call sub:f1().

-module(pmodule, [X]).
-export([x/0]).
x() -> X.

And you can do this:

Obj = pmodule:new(cool),
Obj:x().

It’s true. You can do it right now! Although these features are experimented. see Inheritance in Erlang.

3. other object-oriented languages run on erlang vm.

Reia

ruby-style, every object is a gen_server.

Now, it’s compiler just compile the reia code into the erlang code.

See slide.

ECT(Erlang Class Transformation)

add object-oriented programming to Erlang.

see Object-oriented extension to Erlang.

WOOPER(Wrapper for Object-Oriented Programming in Erlang)

eXAT(erlang eXperimental Agent Tool)

Too old.

Tags: , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: