[1145] 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 16:44:45 1996 )

From: silovic@srce.hr (Miroslav Silovic)
In-Reply-To: <199611291948.TAA00594@aaaaaaaa.demon.co.uk> from Andrew Wilson at "Nov 29, 96 07:48:20 pm"
To: andrew@aaaaaaaa.demon.co.uk (Andrew Wilson)
Date: Fri, 29 Nov 1996 22:37:01 +0100 (MET)
Cc: coldstuff@cold.org

> 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.

	Miro