| Bill Allombert on Wed, 07 Feb 2024 14:35:34 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: (expression) |
On Wed, Feb 07, 2024 at 10:42:10AM +0100, Ruud H.G. van Tol wrote: > > Just an innocent example: > > ? my(i=3, n=3); n + (while(i--, n++);n) > *** syntax error, unexpected ')', expecting )-> or ',': > ...,n=3);n+(while(i--,n++);n) > *** ^- > > ? my(i=3, n=3); n + if(1, while(i--, n++);n ) > %2 = 8 > > > Would it be useful to allow/support (expression)s like in the first format? It is customary to use if(1,...) for that: my(i=3, n=3); n + if(1,while(i--, n++);n) The drawback of your suggestion is that users sometime forget to close parenthesis and allowing ";" inside parenthesis makes that very hard to detect. Also your example modify a variable inside an expression already involving this variable. This copy optimiser does not work well with such code. Cheers, Bill