[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Minor bug declaring arrays of integers: dcl -ai=>broken, dcl -ia=>ok
From: |
Linda Walsh |
Subject: |
Re: Minor bug declaring arrays of integers: dcl -ai=>broken, dcl -ia=>ok |
Date: |
Mon, 22 Jul 2013 01:02:01 -0700 |
User-agent: |
Thunderbird |
Dan Douglas wrote:
> On Sunday, July 21, 2013 08:39:29 PM Linda Walsh wrote:
>> I don't think so. Not from the above.
>>
>> The first sets up an array outside the function composed of integers,
>> so the 2nd time I execute the same, it gets put through the "integer
>> strainer".
>>
>> The bug is that the "-i" isn't applied until after the array assignment
>> is done.. which isn't the case for scalars:
>>
>
> That's exactly what I'm saying. This has been discussed on the list before
> and
> I'm pretty sure Chet knows about it. I wrote about this here over a year ago:
> http://wiki.bash-hackers.org/syntax/arrays#integer_arrays
>
> I think I even have some code that relies upon this effect.
Chet said he knew about it and that it would be fixed -- or have you
not been getting his emails?
it is documented that the "-i" attribute given to a variable will force
expressions
assigned to it to be integers (0 if the rval is a non-integer).
"declare -i myint=expr" will only store an integer or 0 for something that
doesn't
evaluate as an integer.
It's also documented that the -a attribute creates an indexed array variable.
The same should works for hashes -- i.e.
either -a|A should b combinable with -i|l|u to get an array or hash that also
have
the data-type attribute.
I don't understand -- could you explain the rational for why integer array
shouldn't
function the same way integer scalars would w/regards to converting args to
integers?
Maybe you could point at another language that does this and it would become
more clear?
- Minor bug declaring arrays of integers: dcl -ai=>broken, dcl -ia=>ok, Linda Walsh, 2013/07/14
- Re: Minor bug declaring arrays of integers: dcl -ai=>broken, dcl -ia=>ok, Chet Ramey, 2013/07/21
- Re: Minor bug declaring arrays of integers: dcl -ai=>broken, dcl -ia=>ok, Dan Douglas, 2013/07/21
- Re: Minor bug declaring arrays of integers: dcl -ai=>broken, dcl -ia=>ok, Linda Walsh, 2013/07/21
- Re: Minor bug declaring arrays of integers: dcl -ai=>broken, dcl -ia=>ok, Dan Douglas, 2013/07/21
- Re: Minor bug declaring arrays of integers: dcl -ai=>broken, dcl -ia=>ok,
Linda Walsh <=
- Re: Minor bug declaring arrays of integers: dcl -ai=>broken, dcl -ia=>ok, Dan Douglas, 2013/07/22
- Re: Minor bug declaring arrays of integers: dcl -ai=>broken, dcl -ia=>ok, Chet Ramey, 2013/07/22
- Re: Minor bug declaring arrays of integers: dcl -ai=>broken, dcl -ia=>ok, Linda Walsh, 2013/07/23
- Re: Minor bug declaring arrays of integers: dcl -ai=>broken, dcl -ia=>ok, Chet Ramey, 2013/07/27
- Re: Minor bug declaring arrays of integers: dcl -ai=>broken, dcl -ia=>ok, Linda Walsh, 2013/07/28
- Re: Minor bug declaring arrays of integers: dcl -ai=>broken, dcl -ia=>ok, Dan Douglas, 2013/07/28