you are right, i should have given the evaluation code as well:
void main() { write("%O\n", .vars.i); write("%O\n", .vars.s); write("%O\n", .vars.dict); write("%O\n", .vars.list); write("%O\n", .vars.mset); .vars.set(3); write("%O\n", .vars.i); write("%O\n", .vars.s); write("%O\n", .vars.dict); // changed result write("%O\n", .vars.list); write("%O\n", .vars.mset); // changed result }
a further test using -> and [] shows that than all values are changed as expected by looking at set.
the fact that some values are changed in the first test then suggests that the operations:
dict->foo=var; dict->bar=var; mset[var] = 1;
are done at some strange intermediary point before the rest of the code is compiled. while all other operations in set() are done at runtime, where they are accessible to -> and []
something is clearly strange here, and i didn't even go into the difference between dirnodes and joinnodes yet. this is vars.pmod in a single file.
while working on the pike book, i'd at least like to know what is the expected behaviour so that we can describe that, and possibly warn readers about things that they may find working too, but should not rely on.
greetings, martin.