Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [BUG] Can't mark unset variables as read-only



On 4/29/15 3:09 PM, Stephane Chazelas wrote:
> 2015-04-29 11:33:10 -0400, Chet Ramey:
> [...]
>> func()
>> {
>> 	local foo=bar
>> 	echo inside: $foo
>> }
>>
>> func
>> echo outside: $foo
>>
>> Bash gives the following output:
>>
>> ./x26: line 5: local: foo: readonly variable
>> inside: immutable
>> outside: immutable
>>
>> If the purpose of readonly is to make a particular name/value pair
>> immutable, I think that allowing a local variable to shadow it,
>> especially if you're going to export that local variable, is a bad thing.
> [...]
> 
> I don't agree.

OK, we can disagree.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@xxxxxxxx    http://cnswww.cns.cwru.edu/~chet/



Messages sorted by: Reverse Date, Date, Thread, Author