bug-bash
[Top][All Lists]
Advanced

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

Re: Is typeset -a broken if I initialize?


From: Chet Ramey
Subject: Re: Is typeset -a broken if I initialize?
Date: Wed, 31 Mar 2004 09:52:18 -0500

> =>> Machine Type: i386-redhat-linux-gnu
> =>> 
> =>> Bash Version: 2.05b
> =>> Patch Level: 0
> =>> Release Status: release
> =>> 
> =>> Description:
> =>>   If I declare an array using typeset -a and initialize it I get the 
> wrong result.
> =>>   But if I either do not use typeset or initialize seperately it works 
> fine.
> =>
> =>This was the intended behavior through version 2.05b.  I received enough
> =>reports, however, to convince me to change it for the next release.
> =>
> =>Chet
> 
> Thanks for replying. But my question still remains: Why did you do it this 
> way in the first place? What was the desired functionality? Your response 
> indicates that what is happening was deliberate and not an accident.

The basic idea was that such compound assignments were sufficiently
different from `basic' assignment that variables should be declared
before being assigned to in that way.

The fix involved abstracting the (relatively complex) code that performs
compound assignment, identifying those assignments as arguments to
declare/readonly/typeset, and adding the right function calls.

It's a simplifying fix -- makes things easier to explain, even if it is
a special case.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
                                                Live...Laugh...Love
Chet Ramey, ITS, CWRU    chet@po.cwru.edu    http://tiswww.tis.cwru.edu/~chet/




reply via email to

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