Ruud H.G. van Tol on Mon, 12 Aug 2024 12:04:45 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Wrong error message from 2u



On 2024-08-12 08:48, Ilya Zakharevich wrote:
In
   (23:29) gp > my([a,b,c]=[(u-v)^2,2u*v,(u+v)^2]); c^2-a^2-b^2
     ***   syntax error, unexpected variable name, expecting ',': ...,c]=[(u-v)^2,2u*v,(u+v)^2]);c^2-a^2-b^2
     ***                                                                                      ^--------------

the arrow points at the second closing bracket.  The actual problem is
2u.

Another example:

? [2u, 1, 2, 3]
  ***   syntax error, unexpected variable name, expecting ',': [2u,1,2,3]
*** ^-

   P.S.  IMO, 2u should better be parsed (as expected by the user!).

Rather not. For example, 2e1 is already syntax, so can't also mean 2*e1.

-- Ruud