This looks fine:
string a=({"12","34","56"});
Compiler Error: 1: Bad type in assignment. Compiler Error: 1: Expected: string. Compiler Error: 1: Got : array(string(0..255)).
This is confusing:
(string)({"12","34","56"});
cast: Item 2 is not an integer: "56" HilfeInput:1: HilfeInput()->___HilfeWrapper()
Any ideas on how this last one can be improved?
In the last episode (Jan 31), Martin Nilsson (Opera Mini - AFK!) said:
In the last episode (Jan 31), Mirar @ Pike developers forum said:
Logical, but still confusing.
It sort of looks as if "12" and "34" were okay, and it only complained about "56". That's not the case of course, because the array is processed backwards, but why? I'm looking at the T_ARRAY case in o_cast_to_string() and the first loop would work just as well if it ran in the foward direction.
Yes...
Is there any reason the message can't be
cast: Expected array(int): Item 2 is not an integer: "56"
which would explain everything very nicely? :)
It should be "array(string) can not be cast to string" or "Only array(int) can be cast to string" or something similar.
And the fact that it's the last index and not the first that you get the error about is confusing unless you know how pike works internally.
The first once was a compile-time error, but this one is a run-time error.
Any ideas on how this last one can be improved?
Scanning through the array with index 0 (zero) first should be less confusing. Adding some type-checks for casts probably ought to be added to the TODO.
pike-devel@lists.lysator.liu.se