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

Re: two mysteries

On 11/06/2015 10:44 AM, Bart Schaefer wrote:
On Nov 4,  4:38pm, Ray Andrews wrote:
} You're probably right.  It's very hard to track.  However there's no
} question that the type changes from integer when it happens, I've used
} the (t) flag to check.

I suspect further that you're not examining the same variable after the
error as before.  The divide-by-zero is a fatal error, e.g.:

Yup, it always crashes.

Note that the "print" statement was never executed.  If I bring it up
to top level:

torch% integer x
torch% x=foo/bar
zsh: division by zero
torch% print ${(t)x}

But what ended up happening is that the type check reported it as (can't recall) no longer integer, and I did the check just before the fatal division, so something had changed it previous to that. Anyway it hardly ever happens, and hasn't for quite some time so I can't do any more poking at it until it happens again. But the divisor in that case was 'page_hight' which is the terminal hight and (God willing) is never zero. But maybe there's a subterfuge there, with some de novo variable, as you suggest. Hard to keep an eye on these things. With several arrays sloshing around, some rogue value could pop up. But my experiments with Sebastian's stuff has been a real education. I've cut it to 2/3 the size while doubling speed and adding a few features and fixing a few bugs. But it's too big for zsh--one misses the rigorous control of variables.

Speaking of integers, re: my ranting about the type changing. I had a general purpose 'tmp' variable, which I dutifully declared 'integer', and absent mindedly tried to use for a string. and zsh vigorously denounced the effort, which was much appreciated. So at least in that case it wasn't going to entertain any type change. Didn't I read that there's a difference between 'typeset -i' and 'integer'?

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