in Coldmud discussion meeting
Re: [COLD] scatter/optional assignments - request for discussion
daemon@ATHENA.MIT.EDU (Fri Nov 29 19:31:12 1996
From: Andrew Wilson <firstname.lastname@example.org>
To: Brandon Gillespie <email@example.com>
Date: Fri, 29 Nov 1996 23:57:39 +0000 (GMT)
Cc: Miroslav.Silovic@public.srce.hr, firstname.lastname@example.org
In-Reply-To: <Pine.NEB.3.95.961129143634.7322Aemail@example.com> 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):
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