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

Re: Read-only variables in emulation mode



On Jun 16,  2:10am, Mikael Magnusson wrote:
}
} % echo hi; _=foo; echo $_
} hi
} hi

That's actually a bug -- the assignment _=foo should erase $_ , I think.

} % for _ in a b c; do echo $_ hi; done
} hi
} hi hi
} hi hi
} 
} I'm not sure if this is better than printing a warning that $_ is
} readonly. :)

If you go back to the original message in the thread, the whole point
was to use $_ as a dummy variable that didn't need to be declared and
whose value was instantly discarded.  For that purpose, the warning is
extraneous.

Admittedly that's a pretty constrained use case.



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