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

Re: [BUG] functions can't create global readonly variables



By the way it seems that, in bash at least, "readonly" breaks
encapsulation:

$ readonly foo=empty
$ fn() { local foo=bar; echo $foo; }
$ fn
bash: local: foo: readonly variable
empty

The only use I can see of this is for exported variables, where you
might want to ensure a specific value was always exported to an external
programme.

pws



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