[erlang-questions] some language changes

Dmitrii 'Mamut' Dimandt dmitriid@REDACTED
Tue May 22 14:10:55 CEST 2007


Joe Armstrong wrote:
> Comments?
>   
I wonder if better record manipulation could be added to the language.
See
http://yarivsblog.com/articles/2006/10/11/recless-a-type-inferring-parse-transform-for-erlang-experimental/

Example from tha post:
[quote]

The Erlang record syntax gets even more cumbersome when working with
nested records. Let’s say we want to get the city of the owner of
Project. This is how we go about it using the record syntax:

|
City = ((Project#project.owner)
              #person.address)#address.city
|

If you think that’s an eyesore, consider *changing* the value of the city:

|
NewProject =
Project#project{owner =
  (Project#project.owner)#person{address =
     ((Project#project.owner)
        #person.address)#address{city = "Boston"}}}.
|

Yes, I know. Ugly. That’s why I created Recless.

Recless is a parse transform that uses a type inference algorithm to
figure out what kinds of records your variables are holding, and then
lets you write much less code to work with their elements. For example,
with Recless, the above two examples could be written as

|
City = Project.owner.city.
|

and

|
NewProject = Project.owner.address.city = "Boston".|
[/unquote]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20070522/a7eb40df/attachment.htm>


More information about the erlang-questions mailing list