On 12 July 2013 20:19, Cedric Blancher <[email protected]> wrote:
> On 11 July 2013 20:10, David Korn <[email protected]> wrote:
>> cc:  [email protected]  [email protected]
>> Subject: Re: Re: [ast-users] ksh93 returns "()" for "${a[@]}" if I clear an 
>> array  with a=( )
>> --------
>>
>>>
>>> On 10 July 2013 22:18, David Korn <[email protected]> wrote:
>>> > cc: [email protected]
>>> > Subject: Re: ksh93 returns "()" for "${a[@]}" if I clear an array with 
>>> > a=( )
>>> > --------
>>> >
>>> >> ksh93 returns "()" for "${a[@]}" if I clear an array with a=( )
>>> >
>>> >
>>> > a=()
>>> >
>>> > doesn't clear an array, it unsets a and creates an empty compound variable
>>> > (
>>> > )
>>> >
>>> > typeset -a a=()
>>> >
>>> > should clear an array.
>>>
>>> This is not very intuitive. First variable a has already be declared
>>> as an array so the intuitive feeling would be that a=() resets it with
>>> an empty array. 2nd your interpretation assumes that the called
>>> function knows the array data type to reset it - which becomes a pain
>>> if you have hundreds of types defined and try to use a utility
>>> function which should reset an array of any of these types.
>>>
>>> I'd better go for: a=() means reset the variable if variable a is
>>> either array or compound. If it isn't already a type of these make it
>>> a compound variable. If variable a is of type integer or string throw
>>> an error.
>>> This should make things more predictable.
>>>
>>> Ced
>>> --
>>> Cedric Blancher <[email protected]>
>>> Institute Pasteur
>>>
>>
>> I changed this for the next alpha so that
>>         a=()
>> will preserve index and associative array attributes while unsetting the 
>> array.
>>
>> However, it is not an error to redefine a simple variable as a compound 
>> variable.
>
> OK, lets try that out.
>
> Can we have the patch for testing, please?

Trying again to post the mail to the ast lists

Ced
-- 
Cedric Blancher <[email protected]>
Institute Pasteur
_______________________________________________
ast-developers mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-developers

Reply via email to