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

Re: How to have function local variable but must behave just a simple one




On 2023-08-26 13:58, Roman Perepelitsa wrote:

Indeed, given that in zsh there are no function-scoped parameters that
outlive an invocation of the function, Budi will have to use a global
parameter and take necessary precautions to ensure the name of the
parameter does not clash with other globals.

Roman.

I'm puzzled as to what the problem really is from a practical point  of view.  Easy enough to create a 'safe' name, no?  I suppose for  tidiness sake one might not want variables specific to only one function to be global, but there's zillions of that sort of variable already so one lives with that rather easily. And this is universal across all shells, yes?  I have a set of local variables that I need to survive reboot, so I write 'em to a file which is reread on startup.  That would work for Budi, but again it seems like there's not really a big problem.  (Mind, I have a long history of seeing problems where there is no problem ;-)







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