in Coldmud discussion meeting
Re: [COLD] scatter/optional assignments - request for discussion
daemon@ATHENA.MIT.EDU (Fri Nov 29 16:44:45 1996
From: email@example.com (Miroslav Silovic)
In-Reply-To: <199611291948.TAA00594@aaaaaaaa.demon.co.uk> from Andrew Wilson at "Nov 29, 96 07:48:20 pm"
To: firstname.lastname@example.org (Andrew Wilson)
Date: Fri, 29 Nov 1996 22:37:01 +0100 (MET)
> 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?
I might be wrong about this, but Perl, unlike Cold, has global variables.
In Cold, you /always/ know if the variable has been assigned (except
for object vars, but I'm not sure I'd like to see the exception). So,
this behaviour of ?= would be less useful. IMHO, at least. For optional
parameters in  = ... assignment it still won't trigger if right hand
parameters exist but are false.