Re: "dumping" a map

new topic     » goto parent     » topic index » view thread      » older message » newer message
euphoric said...

You can't. Since, as you discovered, "maps" are simply references to in-memory constructs, you cannot "store a map inside a map" on disk. At least, not easily.

The best you can do is convert maps into JSON, which can give you "nested maps." However, even then, it is near impossible to reform a map because there is no way to know what kind of data you stored (not without explicit fields telling you what it is, which I guess is possible, actually).

You hit the nail on the head. I was halfway through drafting my in-depth explanation above when I saw you chimed in.

euphoric said...

When I had questions about this (or a similar) need, Greg Haberek, current Lord of Euphoria, said this is difficult if not impossible in Euphoria's current incarnation.

Hey hey hey. I prefer to use the term proprietor, thank you very much. I'm running the shop and keeping the lights on, not trying to pass decree from on high. Although "Lord" does have a certain ring to it...

euphoric said...

You could also serialize the map and store it that way, but, again, you can't have a map of maps and just "save it to disk" without some indication of what your data was before you serialized it. There's gonna be a lot of processing required.

I wouldn't say "a lot" of processing is required if we're only talking about a single level of nesting. But for multi-level or heterogeneous nesting yeah, it's nearly impossible as-is.

euphoric said...

I guess the point is, maps have a specific use-case in Euphoria right now. You might want to consider another data store... Maybe an SQLite database would be better for your use-case.

Don't discount EDS either. It's a perfectly cromulent data store for simple things. SQLite should hopefully ship with 4.2, whenever we can get it out the door.


new topic     » goto parent     » topic index » view thread      » older message » newer message


Quick Links

User menu

Not signed in.

Misc Menu