SPUG: truth Re: Grep syntax

Fred Morris m3047 at inwa.net
Sat Jun 16 00:06:45 PDT 2007


True true true!

Now: "behaves"? Is there a Perl or Python operator which evaluates that? (Oh, 
bother. Exceptions and all that.)

I think there is a constant tension between language formalists and those who 
attempt to utilize a language for expressive purposes (hence frameworks, 
APIs, scaffolds and so forth). When this tension is X, Y things happen.

On Friday 15 June 2007 12:39, Yitzchak Scott-Thoennes wrote:
> On Fri, June 15, 2007 9:53 am, Michael R. Wolf wrote:
> > You mentioned the 'x' operator with a scalar LHS.
> >
> > With a list LHS, it behaves like the Python idiom you mentioned...
> >
> > my @bcopy = (255) x @b;
> 
> Saying it that way ("With a list LHS") makes it sound like a violation
> of two rules:
> 
> First, that operators provide context to their operands, not vice versa.
> The operator is what decides if what's on it's left is a list or a scalar.
> (For instance, my @bcopy = @b x 1; sets @bcopy to contain a single element
> whose value is the number of elements in @b, not a copy of all the elements
> in @b.)
> 
> Second, related to the first, parentheses don't make a list.  $x = (255)
> is no different than $x = 255.
> 




More information about the spug-list mailing list