[erlang-questions] [ANN] efene programming language 0.1 released

Mariano Guerra luismarianoguerra@REDACTED
Tue Jan 12 06:59:10 CET 2010


On Tue, Jan 12, 2010 at 2:43 AM, Tony Arcieri <tony@REDACTED> wrote:
> On Mon, Jan 11, 2010 at 9:42 PM, Mariano Guerra
> <luismarianoguerra@REDACTED> wrote:
>>
>> efene is a programming language that runs on the erlang virtual machine.
>>
>> the idea is to provide an alternative syntax to erlang that is most
>> suitable for people coming from languages like Java, C, C++, C#,
>> Javascript.

as the text says is an alternative syntax to erlang (with some
syntactic sugar) so don't expect a lot of innovation :)

> As someone dealing with similar problems in my implementation of Reia
> (http://github.com/tarcieri/reia) I have a number of questions about your
> language:
>
> Do you support destructive assignment?

no

> Do you support the "assign" operators that are found in traditional
> imperative languages (e.g. += -= *= /= |= &= ^= <<= >>=)

no

> How do you handle objects?  Your syntax is inspired by JavaScript.  Do you
> provide a prototype-based object model?

I only implemented some syntactix sugar for records, I don't know if
it will stay that way but it's a beginning, here is an example:

http://github.com/marianoguerra/efene/blob/master/examples/record.fn

as you see you have a way to handle records with a simpler syntax (at
least for me) and you don't need to import the record declaration to
access it, also you can access the record field at runtime and do
something like "duck typing" on records, checking if the record has a
field etc.

I highly appreciate comments on this one

> How do you handle concurrency?

exactly like erlang

http://github.com/marianoguerra/efene/blob/master/examples/send.fn

> How do you handle distribution?

code distribution? app distribution?

> How do you interface back with Erlang?

it's almost 1:1 with erlang code so you just use the erlang modules*

> How do you handle exceptions?

just like erlang :)

http://github.com/marianoguerra/efene/blob/master/examples/trycatch.fn

as I said above it's just an alternative syntax with some syntactic
sugar. I started it because when I started learning erlang some months
ago I found the syntax a little scary (I come from the languages I
named above) and as an excuse to learn more erlang and help people as
me I decided to start this project.

* in fact the compiler has an option to transform any efene source
file to erlang, here is an example with the record.fn example so you
can see how the code is generated:

mariano@REDACTED:~/Proyectos/efene/examples$ ../bin/fnc -t erl record.fn
-module(record).

-compile(export_all).

-record(person, {firstname, lastname, mail}).

person(Firstname, Lastname, Mail) ->
    Obj = #person{firstname = Firstname,
                  lastname = Lastname, mail = Mail},
    Wrapper = fun (Self, Person) ->
                      fun (getfirstname) -> Person#person.firstname;
                          (getlastname) -> Person#person.lastname;
                          (getmail) -> Person#person.mail;
                          ({setfirstname, Value}) ->
                              Self(Self, Person#person{firstname = Value});
                          ({setlastname, Value}) ->
                              Self(Self, Person#person{lastname = Value});
                          ({setmail, Value}) ->
                              Self(Self, Person#person{mail = Value});
                          ({has, Field}) ->
                              lists:member(Field, [firstname, lastname, mail]);
                          (record) -> Person;
                          (fields) -> {firstname, lastname, mail};
                          (name) -> person
                      end
              end,
    Wrapper(Wrapper, Obj).

run() ->
    P = person("mariano", "guerra", "mail"),
    Print = fun (X) -> io:format("~p~n", [X]) end,
    P = person("mariano", "guerra", "mail"),
    Print(P(getfirstname)),
    Print(P(getlastname)),
    Print(P(getmail)),
    Print(P(record)),
    Print(P(fields)),
    Print(P(name)),
    Print(P({has, firstname})),
    Print(P({has, address})),
    P1 = P({setfirstname, "Mariano"}),
    Print(P1(record)).


More information about the erlang-questions mailing list