Why is setting a Key -> Value in a map type failable in Verse?

As the title says, I and some other Verse programmers were just talking about the topic regarding failable context in Verse, and we came across this question:

var MyMap : [keytype]valuetype = map{}

if(set MyMap[Key] = Value)

Why is this (the second line) failable? What is failable about this concept? It is understandable why attempting to access a value in a map is failable, but why setting? If there is a Key β†’ Value already for this map, should it not overwrite the value? And if the value does not exist, should it not add the Key β†’ Value (considering all β€œmutable” data replaces itself). Would love to get some insight as the removable of this failable context could greatly benefit the legibility of some code, as this often results in if statements with nothing following just to get passed the failable context.

3 Likes

It could be possible that the Map type is not thread safe and therefore, in the attempt that reading from a map while also accessing / modifying it (in this case setting it) could throw an access violation exception. Not a definitive answer but rather food for thought.