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

Philip Robinson <>
Fri Jun 6 14:13:14 CEST 2008

2008/6/5 Vlad Dumitrescu <>:
> The big problem with this matter is that Erlang doesn't have variable
> assignment, it has pattern matching. So if we encounter a reference to an
> old variable in a pattern, should the old variable be used to check if it
> matches, or should a new fresh variable be created and matched against the
> right side? This could be solved for example by using special characters to
> denote fresh matching, but IMO the resulting mess is worse than the issue
> that it was created to solve.

That's exactly what Reia pattern-matching does, with an asterisk in
front of the variable name to denote pattern matching instead of
binding a new value.
An example from the Reia pattern-matching documentation

  >> foo = 42
  >> (*foo, [bar, baz]) = (1, [2, 3])
  NoMatch: right hand side value 1

I'm not yet sure how to handle multiple occurrences of a value,
though.  Perhaps this is how it would be done:

   >> (blub, *blub) = (42, 42)

I have only browsed the Reia site and haven't actually downloaded and
tried it - to be honest I'm more interested in LFE right now. :-)


More information about the erlang-questions mailing list