[erlang-questions] Reia - Python/Ruby mix targeting Beam/HiPE

Tony Arcieri <>
Mon Jun 16 03:21:59 CEST 2008


On Wed, Jun 4, 2008 at 1:57 PM, Deryk Barker <> wrote:

> I was quite interested until I saw that it supports multiple
> assignments to a variable.
>

Hi everyone, I'm Reia's creator.  I wasn't quite ready for Reia to wind up
here yet, but since it has, here's my responses to the concerns that have
been raised.  I'll also be doing an official announcement some time in the
next few weeks, when I've finished implementing the majority of the features
found in sequential Erlang.

--

On multiple assignment / modifying receivers: I'm still torn on this.
Multiple assignment is not actually supported in Reia yet.  I'm not
necessarily sure if I really like the idea, but I'm probably still planning
on implementing it soon.

The basic idea is to use alpha conversion which maps to new identifiers
whenever a variable is potentially rebound.  This is what Mikael was
describing in the first example above. The bodies of imperative loops are
decomposed into named, tail recursive functions which return the new values
of any potentially rebound variables, and the binding in the scope of the
original function is updated when the looping function returns.

Quite a few hoops to go through just to remove what's arguably one of
Erlang's most important features.  Furthermore state in Reia remains
immutable which can cause some confusion, since multiple assignment with
immutable state doesn't give the same semantics that mutable state does (for
example, old references to the same structure are not updated when the
structure is "mutated").  This may be particularly confusing with functions
that modify their receiver, since a new copy of the receiver is made with
the modifications and the original binding updated to point to the new
version.

All that said, you may see all references to multiple assignment removed
from the Wiki soon.  I'm still mulling it over.

--

On Core Erlang: I'd originally considered having Reia target Core Erlang.
However, Reia makes extensive use of erl_eval.  Reia's interpreter allows
code outside the scope of modules, / functions, which is evaluated using
erl_eval.  Reia also has an interactive interpreter / REPL which uses
erl_eval.

Perhaps I'm just ignorant but I know of no way to evaluate Core Erlang.
I've noticed many projects which target Core Erlang do not have interactive
interpreters and it seems to be for this very reason.  I consider an
interactive interpreter an essential feature, and erl_eval is also the
source of Reia's scripting abilities (i.e. arbitrary code defined outside
modules).

I'd like to eventually target Core Erlang, but it seems that in order to do
so I'd have to write my own eval for Reia's forms or implement conversion of
Reia to both Erlang forms and Core Erlang forms, and neither of those sound
like particularly desirable options, at least for the time being.

If someone knows of a way to eval Core Erlang, it'd certainly resolve all
these problems.

-- 
Tony Arcieri
medioh.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080615/57f9ccf7/attachment.html>


More information about the erlang-questions mailing list