Re: map anomaly

new topic     » goto parent     » topic index » view thread      » older message » newer message
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] 
 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu