bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: typeset -r prevents local variable of same name.


From: Chet Ramey
Subject: Re: typeset -r prevents local variable of same name.
Date: Thu, 17 Feb 2011 15:09:02 -0500
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7

On 2/17/11 12:11 PM, Eric Blake wrote:

>>> Description:
>>>     First, I already submitted this bug from work, but I didn't
>>>  realize that the address I sent from would not be allowed to receive
>>>  a response. This address will work fine.
>>>
>>> If I declare a variable at the top scope using -r, it will prevent me
>>> from declaring a local copy in a subroutine. This problem happens in
>>> this version of bash as well as in bash4 under Fedora 14.
>>
>> This is intentional.  A variable is declared readonly for a reason, and
>> readonly variables may not be assigned to.  I don't believe that you
>> should be able to use a function to circumvent this.
> 
> Consensus on today's Austin Group meeting was that since we are
> interested in standardizing local variables (or at least a subset of the
> 'typeset' special built-in's capabilities), this needs to be uniform
> across implementations.  The Austin Group would favor the ability to
> create a local read-write variable that shadows a global read-only
> variable, which would entail a change to this bash behavior.

When an interpretation gets released, or a statement of direction for a
future revision, I will change the bash behavior to match it, at least
in Posix mode.  I will look forward to seeing the minutes from the
Austin Group meeting.

Chet

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]