Op 17-03-17 om 23:08 schreef Thorsten Glaser:
> Martijn Dekker dixit:
> 
>> Op 17-03-17 om 20:53 schreef Thorsten Glaser:
>>> Even mksh’s “global” builtin does not access the global scope.
>>> It’s simply a “typeset” that’s not also “local”.
>>
>> But why the separate builtin (which is unique to mksh, if I'm not
>> mistaken) rather than 'typeset -g' as in zsh, bash 4 and yash?
> 
> Oh. I was not aware of that.
> 
> I think that’s sufficient to deprecate “global” even. Thanks!

Neat. :)

One nitpick with the new man page phrasing though:

| Create parameters in global scope, not in local scope.

That's not quite accurate, as was also explained by the old explanation
for the 'global' command which was patched out: typeset -g "does not
allow a function called from another function to access a parameter at
truly global scope, but only prevents putting an accessed one into local
scope." IOW, it may still inherit the enveloping local scope from a
calling function.

- M.

Reply via email to