[erlang-questions] If you are homesick for object.selector
Fri Jan 25 19:34:44 CET 2013
On Fri, Jan 25, 2013 at 12:26 PM, Fred Hebert <> wrote:
> On 01/25, Garrett Smith wrote:
>> Let's compare this:
>> Strength = '?'(Char, [stats,skills,strength])}
>> to this:
>> Strength = Char.stats.skills.strength
>> Now, which would a beginner prefer? The first version is *terrifying*.
>> And if the programmer *could* brave the syntax, what about all that
>> extra typing?? Just looking at that code makes my fingers tired :(
>> That's why Ruby is #2 on github language ranks and Erlang isn't even
>> in the top 10! 
> Of course it's terrible. It's a 15 minutes attempt to show it's doable
> to navigate deeply nested data structures. I might as realistically make
> a function that accepts:
> Char = set(new, stats,skills,strength, 50)
> Strength = get(Char, stats,skills,strength)
Indeed, I was just using your code as a straw man :)
When chaining operations like that, I too use lists. It's the natural
thing to do in Erlang for that case I think.
> There are reasons for Erlang to not be that used, but accessors for deep
> data structures are likely not the most important part of it. I'd
> probably bet on the difficulty to translate algorithms that assume O(1)
> access to hashes or arrays, with destructive updates, as a significant
> barrier of entries with far fewer easy workarounds.
> That's all speculation anyway.
More information about the erlang-questions