help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] What was the reason to give declare its name?


From: Chet Ramey
Subject: Re: [Help-bash] What was the reason to give declare its name?
Date: Thu, 1 Dec 2016 08:33:15 -0800
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.5.0

On 12/1/16 3:16 AM, konsolebox wrote:

> I'm more interested to know why `declare` was made to declare
> variables in the local context by default, when there's already the
> `local` builtin. 

Your history is backwards.  `declare' predated `local', which only came
in just before 1990 in response to a late draft (D9?) of Posix.2-1992.
Since declare already had the desired semantics, it was easy to add local.

> Was it because it was meant to remain compatible with
> `typeset`? And even if `local` was added later (if it was added
> later), I think it was still early enough for `declare` to be able to
> change behavior.  We could have enjoyed global declaration of
> associative arrays as early as 4.0.

All of this happened before 1990, and there wasn't any inclination to
make bash incompatible with ksh.

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



reply via email to

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