SPUG: interesting while() behavior and hosting recs

Yitzchak Scott-Thoennes sthoenna at efn.org
Sun Oct 3 05:23:36 CDT 2004

On Fri, Oct 01, 2004 at 10:46:36AM -0700, Tim Maher wrote:
> As a case in point, I offer the widespread notion that parens
> function as "list constructors" in expressions like
> "@array=(1,2)" and "print (1,2)", which is tremendously useful,
> despite being less than a perfectly accurate representation of
> how those expressions are actually parsed and evaluated, IIRC.
> (What's the real story? Is it that the comma operator in list
> context returns all the expressions, so the parens are just there
> for reasons of precedence in the case of an assignment?)

They are just there for reasons of precedence.  Parens really really
really truly don't function as list constructors.

> Surely, even in Perl, there are some elements of basic syntax
> that can be trusted to have concrete meanings -- like while's
> parens; aren't there? 8-}

While's parens are just part of the syntax; they don't function as
parens; as perly.y says:

   loop    :       label WHILE '(' remember mtexpr ')' mblock cont

Same thing with the parentheses around a function's parameters.

More information about the spug-list mailing list