Re: Oops! I threw a return value in the trash by mistake
- Posted by Spock Jun 01, 2016
- 1201 views
The other one me and my clumsy fingers are often grateful for is
if length(x=0) then
which in Phix generates the compile-time error "incompatible type for routine signature" - unlike OE you would need sq_eq(x,0) to deliver anything other than a single T/F, and length(atom) is fatal, not 1.
When length() was updated to include atoms the change caught me completely by surprise. But it's more of a nuisance than a big problem so I never did anything about it. I would have coded this line as:
if not ~x then
But this has its own problem since the tilde, while quick to type, is also easy to omit. So then would I ever return to using length()? - N e v e r
As for discarded return values, I think I had this in Orac before OE. What I also added at the time was a method to analyse the program (wholly or by module) which could find all functions invoked as if they were procedures.
Spock