[erlang-questions] If you are homesick for object.selector

Evan Miller <>
Thu Jan 24 17:13:41 CET 2013


On Thu, Jan 24, 2013 at 9:18 AM, Loïc Hoguin <> wrote:
> Now I know this isn't the Erlang way, but I'm sure there can be a solution
> that allows to write something similar. Frames looked like a pretty good
> step in the right direction. Regardless of syntax, I'm sure we can have
> something like:
>
>   Character2 = Character{weapon{ability{cost=123}}}
>
> Where it would be checked against the proper type, evaluated at runtime, and
> return a copy of Character with the requested modifications. This can work
> for access, "modification", and pattern match. The user would be aware that
> it has runtime costs, but will likely still choose this because it allows
> him to actually get the work done. There's many projects that I wouldn't
> even dream to do because of how tedious it would be, as I want to get my
> project running and not battle endlessly to modify my data.

Is there any chance we could make the colon operator left-associative?
That way children of Satan could waste precious CPU cycles writing
things like

Cost = Character:weapon():ability():cost()

While laughing maniacally and dancing around a burning pyre of Prolog books

>
>
> --
> Loïc Hoguin
> Erlang Cowboy
> Nine Nines
> http://ninenines.eu
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions



--
Evan Miller
http://www.evanmiller.org/



More information about the erlang-questions mailing list