Re: "dumping" a map
- Posted by petelomax Feb 17, 2023
- 1867 views
The only way you could achieve that sort of thing is to tag any nested dictionaries properly,
so instead of storing 7, you store {"map",7} and it is your responsibility to ensure that nothing
ever naturally occurs which could accidentally be mistaken for that. Equally you could have say
{"building_plot", width, depth, price, dictionary_id} whereby [4] is always a dict (or 0/absent).
Tags are a pretty minimal overhead, and will more than easily repay their rent by helping with debugging.
As for saving to disk, then instead of saving {"map",7} you would have to store something like {"map","customers"},
and one thing Phix does have is the ability to give a name to a dictionary when it is created, and retrieve the
dictionary-id from a name, but otherwise not much else. Dictionaries are meant to be transient anyway, so if you are
looking for more permanent storage you would be far better off just using an SQLite database or similar.