erlog icon indicating copy to clipboard operation
erlog copied to clipboard

Support Erlang maps in 17.x

Open zkessin opened this issue 10 years ago • 6 comments

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

zkessin avatar Aug 01 '14 07:08 zkessin

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

rvirding avatar Aug 17 '14 02:08 rvirding

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

zkessin avatar Aug 17 '14 03:08 zkessin

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.

rvirding avatar Aug 17 '14 17:08 rvirding

how we mirror the erlang syntax #{...}

zkessin avatar Aug 17 '14 17:08 zkessin

The other question is that if we add this, can we also continue to support pre 17 versions of Erlang?

zkessin avatar Aug 24 '14 07:08 zkessin

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

rvirding avatar Aug 25 '14 13:08 rvirding