this one is puzzling:
mixed fun = lambda(){ return 1; }; fun[""];
Bad argument 1 to Gmp.mpz(). Expected int|float|Gmp.mpz|Gmp.mpf|Gmp.mpq. Unknown program: Gmp.mpz(HilfeInput()->__lambda_66024_0_line_1)
canthat be made to print Indexing on illegal type.
instead?
greetings, martin.
The type isn't illegal.
Pike v7.6 release 112 running Hilfe v3.5 (Incremental Pike Frontend)
1[""];
Indexing the integer 1 with unknown method "". HilfeInput:1: HilfeInput()->___HilfeWrapper()
1["sgn"]();
(1) Result: 1
But the error in your example seems wrong, yes.
Ah, sorry, missed the lack of parentheses... This works as expected:
Pike v7.6 release 112 running Hilfe v3.5 (Incremental Pike Frontend)
mixed fun = lambda(){ return 1; }; fun()[""];
Indexing the integer 1 with unknown method "". HilfeInput:1: HilfeInput()->___HilfeWrapper()
of course, ideally, i'd like to see something like:
can not index a function [*]
but i'd be happy with anything that at least gives a hint that there is an indexing error.
greetings, martin. [*] actually, i wish any type was indexable with the members of the respective type modules, as we discussed at the last conference, but that's a different topic.
getting it to work is not the issue though, but understanding the error that occured when trying to index a function.
greetings, martin.
A function can only be indexed if it can be converted to a program (i.e. if it actually is a program from the pike programmer point of view).
That error message doesn't intentionally imply it can be indexed, though. It prints the indexing value in all cases just to be more informational; it's often not obvious from neither the backtrace nor the source.
pike-devel@lists.lysator.liu.se