[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.

Example from tha post:

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)

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

NewProject =
Project#project{owner =
  (Project#project.owner)#person{address =
        #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.


NewProject = Project.owner.address.city = "Boston".|
-------------- 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