Autrijus Tang wrote:
On Sun, Feb 27, 2005 at 04:14:34PM -0500, Abhijit Mahabal wrote:

I hunted down the cause of the non-parsing of
 ok((2 + 3) == $five, "== (sum on lhs)");
in 03operator.t, but am not yet up to speed in Haskell to fix it.

Below is the location of the problem.

The error is in Parser.hs, in the blocks for parseApply and parseParamList. parseApply eats parens using maybeDotParens, and then calls parseParamList, which is also willing enough to gobble more parens.
Thus the following fails to parse: f((2+3),5), but this succeeds: f(((2+3), 5)).


...and the solution is to change maybeDotParens into a simple
maybeDot. Much thanks for tracking this down! It's been fixed in 6.0.9.

Hmm. I wonder if that introduces more bugs itself. Is the following legal?
f ($x)
I know f($x) is legal, and so is f .($x), and space without dot is illegal for methods, but I could not find the relevant thing for subs in S06 or S12.


In any case, consider the following program. It prints "10" in all four lines in the current version of pugs(svn rev 497):

=====================
use v6;
sub f([EMAIL PROTECTED]){
  @x[0] + @x[1];
}

say "Expecting 10:     ", f((2+3), 5);
say "Expecting error?  ", f ((2+3), 5);
say "Expecting  10:    ", f 2+3, 5;
say "Expecting  8.2??: ", f .2+3, 5;
=======================

At least getting a 10 on the last line is very surprising for me.

--abhijit





Thanks, /Autrijus/

Reply via email to