[erlang-questions] Maps

Loïc Hoguin essen@REDACTED
Tue May 14 18:38:38 CEST 2013

On 05/14/2013 03:07 PM, Robert Virding wrote:
> Loïc you and I can meet at dawn like gentlemen to discuss special syntax or not. Swords or pistols? :-)


I don't disagree with most of what you say. The special syntax isn't 
really needed until you get a project where you need to keep really many 
things in the state (hundreds if not thousands of terms per connection) 
and update them many times, in my case many times per second, while 
still striving for low latency.

When you have that many values, your first enemy is verbosity, not only 
to be able to write the code fast, but also to find the bugs in it 
quicker. Execution speed only comes after. Of course by verbosity I 
don't mean saving a character or two, I mean that what the code says is 
simpler. For example, why would you want to say "I want to extract this 
value V1 then extract this value V2 then modify a value in V2 then put 
V2 back in V1 then put V1 in the original structure" instead of "I want 
to modify this deep value there"? We shouldn't have to worry about all 
these intermediate operations. They're a lot longer to write, and a 
bigger source of error.

My personal use case is probably not that universal, but I believe it 
also applies to anyone who has to access or modify JSON or equivalent 
(not XML). How do you access deep values in JSON in Erlang? How do you 
update a value in JSON? How do you update 20 of them? Painfully. You can 
write functions to do it if you don't need to do it many times in your 
program, but the more you need to do it the more you'll want a special 
syntax to actually get things done instead of handling the details of 
the modification.

Loïc Hoguin
Erlang Cowboy
Nine Nines

More information about the erlang-questions mailing list