Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: return status of the 'let' builtin



On Sat 4 Apr 2026, at 20:22, Jun T wrote:
> I think we should check errflag in bin_let() as in execarith()
> (see tentative patch below).

i think this makes sense based on the documentation

On Sat 4 Apr 2026, at 20:22, Jun T wrote:
> What is the correct return status of 'let 0.0/0.0' or
> '(( 0.0/0.0 ))'? ... Should we return 2 here?

it depends on whether we consider division by zero an error for floats

if we do, it seems like we should abort the expression entirely, emit an
error message, and return status 2, as we do with 0 / 0. that's the
expected behaviour with an error

if we don't, returning 0 seems correct, since NaN != 0

i don't feel strongly either way but i lean towards not changing it
since it currently works as documented

dana




Messages sorted by: Reverse Date, Date, Thread, Author