It appears that when Pike is presented with a comparison like:
a<=b
And given the availability of `< and `<= and `== operators, it insists on using `< first, and if that fails it uses `==. Instead of using merely `<= directly.
Am I missing something here or is that a missed optimisation?
I think no `<= lfun exists. There is a manual page at
http://pike.lysator.liu.se/generated/manual/modref/ex/lfun_3A_3A.html
which lists all of them.
On 08/27/14 09:47, Stephen R. van den Berg wrote:
It appears that when Pike is presented with a comparison like:
a<=b
And given the availability of `< and `<= and `== operators, it insists on using `< first, and if that fails it uses `==. Instead of using merely `<= directly.
Am I missing something here or is that a missed optimisation?
Arne Goedeke wrote:
I think no `<= lfun exists. There is a manual page at
http://pike.lysator.liu.se/generated/manual/modref/ex/lfun_3A_3A.html
which lists all of them.
Ok, fair enough. It is confusing though that this list is present twice. There undoubtedly is a good reason for that, but it confusing to the reader and there should be crossreferences from one to the other or similar.
E.g. compare: http://pike.lysator.liu.se/generated/manual/modref/ex/predef_3A_3A/_backtick... http://pike.lysator.liu.se/generated/manual/modref/ex/lfun_3A_3A/_backtick_5...
Its not the same list; one describes the functions which implement the operators and the other ones are lfuns. They are related in that the ones from predef:: will call the corresponding lfun. In the documentation you linked, a cross reference exists.
Maybe the overall structure is not so clear (i.e. predef::`[] vs `[]) and the documentation should be improved?
On 08/27/14 19:40, Stephen R. van den Berg wrote:
Arne Goedeke wrote:
I think no `<= lfun exists. There is a manual page at
http://pike.lysator.liu.se/generated/manual/modref/ex/lfun_3A_3A.html
which lists all of them.
Ok, fair enough. It is confusing though that this list is present twice. There undoubtedly is a good reason for that, but it confusing to the reader and there should be crossreferences from one to the other or similar.
E.g. compare: http://pike.lysator.liu.se/generated/manual/modref/ex/predef_3A_3A/_backtick... http://pike.lysator.liu.se/generated/manual/modref/ex/lfun_3A_3A/_backtick_5...
According to http://pike.lysator.liu.se/generated/manual/modref/ex/lfun_3A_3A.html, there doesn't exist any `<= lfun, so then it's hardly surpising it isn't used...
Just to expand a bit, ` is _not_ a syntax to declare an lfun. It's just a syntax to create certain identifiers not conforming to the usual letters-and-numbers form. Kind of like the | character in Common LISP. You can use such identifiers anywhere, for example
int `< = 3;
is a correct declaration of a local variable.
A method is treated like an lfun iff its name matches one of the existing lfun names. Not all lfuns have names using the ` form (for example "_indices" and "_values" do not), and not all names on the ` form are lfuns (examples include your "`<=", and things like "```!" (no lfun currently has a name with more than two ` at the beginning)).
pike-devel@lists.lysator.liu.se