[1147] in Coldmud discussion meeting

root meeting help first first in chain previous in chain previous next next in chain last in chain last

Re: [COLD] scatter/optional assignments - request for discussion

daemon@ATHENA.MIT.EDU (Fri Nov 29 19:31:12 1996 )

From: Andrew Wilson <andrew@aaaaaaaa.demon.co.uk>
To: Brandon Gillespie <brandon@glacier.cold.org>
Date: Fri, 29 Nov 1996 23:57:39 +0000 (GMT)
Cc: Miroslav.Silovic@public.srce.hr, coldstuff@cold.org
In-Reply-To: <Pine.NEB.3.95.961129143634.7322A-100000@glacier.cold.org> from "Brandon Gillespie" at Nov 29, 96 02:40:26 pm

> > I didn't look too closely at this patch, but am I right in thinking
> > that the ?= operator is a simple test of existing value, rather
> > then an operation which is only performed if a variable has not
> > been assigned to previously?
> > 
> > Perl has a useful:
> > 
> > 	$foo = $bar unless $foo;
> > 
> > construction, which only assigns a value to $foo if no previous
> > assignment has taken place.
> > 
> > Wouldn't this be logic (expressed as '$foo ?= $bar') be more useful?
> > 
> > Ay (prepared to be clueless...)
> 
> IMHO no--perl's "unless" drives me up the wall (along with a few of its
> other operators).  It changes the focus from left to right to right to
> left simply for the fact that then it can use a cute word rather than an
> operator and it supposedly makes 'sense' as you read it. Using ?= stays
> left oriented, and fits in with existing operators, and is also shorter :) 
> (it also 'reads' better IMHO):

[snip]

Sure.  I don't care about the syntax and ?= is better than unless,
and I want' suggesting that a different syntax be used.  I wanted
to know if the 'if' test implicit in ?= was on the existing value
of the variable or if it was a test for wether or not a value had
been assigned to the variable.

It may be the case that it really doesn't matter which property of
a variable you test (its value, or its settedness).  In which case
fine.

Ay.