Consistent wrt the case I mentioned. It wouldn't work to try to make it consistent with mappings: A mapping equivalent to these arrays would be (based on that `[] still operates the same):
([0:1, 1:2, 2:3]) | ([0:2, 1:4, 2:1, 3:17]);
(1) Result: ([ /* 4 elements */ 0:2, 1:4, 2:1, 3:17 ])
I.e. ({1,2,3})|({2,4,1,17}) should produce ({2,4,1,17}) to make that isomorphism hold, which is clearly useless for `|.
/ Martin Stjernholm, Roxen IS
Previous text:
2002-12-03 19:11: Subject: `| and order on arrays
[...] I furthermore expected the elements in the first array to remain unchanged with precedence over those in the second, since that makes it behave more consistently when used as |=, in which case all the elements in the left operand would remain on the same indices.
Consistant with what? Giving the right operand precedence is consistant with the other |(=) operators AFAIK:
Pike v7.3 release 62 running Hilfe v3.5 (Incremental Pike Frontend)
(["hej":17])|(["hej":42]);
(1) Result: ([ /* 1 element */ "hej":42 ])
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)