Re: map anomaly

new topic     » goto parent     » topic index » view thread      » older message » newer message
WhatEverNickYouLikeHere said...
jimcbrown said...
eukat said...


Give the first (or last) element of your maps a unique label, then you can test that element in that object for being a map in a type test you write.

eukat

That won't work. Integers (and therefore the value directly stored in the map variable itself) don't have elements.


Your runtime type check code cannot open the map and look at the first (or last) element, thereby doing a pass/fail on opening the map and a pass/fail on the first (or last) element?

WhatEverNickYouLikeHere

It won't be my runtime type check code in any case.

Anyways, while that is possible (I'm ignoring the difficulty of consistently ensuring that a certain value is always the first or the last element in the sequence that is used as the backing of a map), it would not have any utility in distingushing all maps from all non-map types. At the point where the code is opening the map, it is already assumed (correctly or not) that we are dealing with a map. It doesn't assist in telling if the value 1 in "map x" is a map, or if the value 1 in "integer stdout" is an integer (or a file descriptor).

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

Search



Quick Links

User menu

Not signed in.

Misc Menu