Re: map anomaly
- Posted by DerekParnell (admin) Aug 04, 2012
- 1307 views
bugmagnet said...
So a map is an atom. Ok, have got that down pat. So how does Euphoria tell the difference between an atom created with map and a normal atom?
It can't. Just like you can't tell the difference between the answer to 1 + 1, and the answer to 4 / 2.
This is because, the atom returned by the map:new() function is just an ordinary integer. However, that integer represents a map structure. In fact, it is merely an index into a hidden sequence, and the sequence element referenced by the map integer is what actually contains the map data.
So in effect ...
map x = map:new() atom y = 1 HIDDEN_SEQUENCE[x] is HIDDEN_SEQUENCE[y] is HIDDEN_SEQUENCE[1]