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

Re: "typeset -p" and no_GLOBAL_EXPORT, other misc.



On Tue, Mar 12, 2024 at 1:06 PM Stephane Chazelas <stephane@xxxxxxxxxxxx> wrote:
>
> 2024-03-12 11:32:41 -0700, Bart Schaefer:
> >
> > Looks like "integer" et al. in bash actually search for the parameter
> > using the type [...]
> >
> > Does it always use outermost scope or does it just use the "nearest"
> > integer (in this example) that it finds?
>
> Sorry, you're missing my point. bash doesn't have an "integer"
> builtin.

Fine, but my point was that the type and name are both used to search
for the parameter.  If you instead wrote:

$ f() { typeset -i i; integer i=2+2; echo "$i"; }

Would that still find the global $i instead of "the $i in f"?

> > Aside:  Shouldn't IGNORE_CLOSE_BRACES be set in ksh emulation?  It
> > currently is not.
>
> I'd say
>
> $ zsh --emulate ksh -c 'echo go}'
> zsh:1: parse error near `}'
> $ zsh --emulate ksh -o ignoreclosebraces  -c 'echo go}'
> go }

Also beside the point, which is that the first of these three is wrong:

% zsh --emulate ksh -c '{ echo go }'
go
% zsh --emulate ksh -o ignoreclosebraces -c '{ echo go }'
zsh:1: parse error near `}'
zsh --emulate ksh -o ignoreclosebraces -c '{ echo go; }'
go




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