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

Re: for loop 'bad math expression'



On Jan 30, 2024, at 8:50 AM, Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:


BTW Bart, just a post mortem on that: I know there are situations where a plain vanilla scalar is promoted to integer when the situation requires it.

In what situations is the integer attribute automatically given to an existing variable that did not previously have it?

In the above, I wonder about an automatic demotion.  The situation plainly had nothing to do with arithmetic

Under no circumstances should zsh take it upon itself to automatically remove the integer attribute. If you don’t want it to enforce the integer constraint, don’t assign the attribute. Nothing requires you to use it.

OTOOH perhaps automatic 'non demotion' would be possible -- zsh might have robust defenses against making a mistake.

This is wishful thinking.

-- 
vq
Sent from my iPhone






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