erlog
erlog copied to clipboard
Support Erlang maps in 17.x
We should support maps as a data structure. SWI Prolog has a syntax for something similar (Dicts) http://www.swi-prolog.org/pldoc/man?section=dicts I think adapting it wholesale might be a good place to start, but lets talk about it
@rvirding
Either that or not add special syntax but go through some procedures like map/3/4:
map(Key, Map, Value) map(Key, Map, Value, NewMap)
Something like you suggested for records. I don't know but it needs considering as being able to handle maps would be useful (for example for JSON).
I think in the long term a more expressive syntax is probably better, but in the short run this might be a better way to at least get access to the data
We are still going to need some syntax so we can print them, and in the long run enter them. Unfortunately we can't use a straight {key => val, key => val}
as {...}
is already taken.
how we mirror the erlang syntax #{...}
The other question is that if we add this, can we also continue to support pre 17 versions of Erlang?
You can if you are a bit cunning and first check which version of erlang you are using. Also depends on how much you want to use the map syntax vs going through the maps module.
Did this in LFE.
Robert
From my Nexus