On 8/23/25 11:40 PM, Martin D Kealey wrote:

On Wed, 20 Aug 2025 at 00:15, Chet Ramey <chet.ra...@case.edu <mailto:chet.ra...@case.edu>> wrote:

    No different than evaluating a variable value in an expression as an
    expression.


In other languages, binding and assignment are clearly different operations, where this would clearly NOT be "no different".

Oh?

int x = 0;

In any event, the comment you quoted was an answer to your "looks like
infinite recursion."


     > I would rather that assignment modifier flags (-i, -l, -u, -r}
    simply be
     > ignored when binding.

    I'm sure you would, but that's neither backwards compatible nor compatible
    with other shells (ksh93, mksh, even zsh) that impletment declare/typeset.


In respect of -l, -u and -r, that's fair comment, so let's set those aside and focus on binding with -i, where the old behaviour was to fail silently.

Why would you ignore -i, since it has the same backwards compatibility
issues as the others?

$ ksh -c 'typeset -i x=3+4 ; echo $x'
7

Or are you only considering the -in case, where the issue was that a value
that expanded to a variable name that wasn't a valid nameref didn't
generate an error message? If you are, then make your reasoning explicit.

Or are you considering

$ ./bash -c 'x=3+7; typeset -i x; echo $x'
3+7

and suggesting that bash perform arithmetic evaluation on an existing value
when setting the integer attribute (which would actually be compatible
with other shells), and echo `10'?


Ignoring -i when binding (only applying it when assigning) would seem like a reasonable backwards-compatible extension,

It's not backwareds compatible, but you know that. Maybe you could give
an example of what you mean.

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

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to