Hi all,
I've had a little run in with strict types, and I fail to convince
myself that certain aspects of its behaviour have merit.
Consider
$ cat test.pike
#pragma strict_types
void main() {
array(array(mixed|string)) to_be_mapping = ({
({ "foo", 1 }),
({ "bar", "xxx" }),
});
mapping(string:int|string) m;
#ifdef WORKAROUND
mixed mix(mixed m) {
return m;
}
#else
# define mix(X) (X)
#endif
m = [mapping(string:int|string)]mix(mkmapping(to_be_mapping[*][0],
to_be_mapping[*][1]));
}
$ ~/local/bin/pike test.pike
test.pike:17: Warning: An expression of type mapping(mixed:int |
string) cannot be assigned to a variable of type mapping(string:int |
string).
$ ~/local/bin/pike -DWORKAROUND test.pike
(no output indeed)
Am I correct to assume that silently - somehow - not accepting my
softcast in at least some regards on something like
mapping(mixed:int|string) while accepting it on mixed might not be
intended behaviour?
Tobi