Subject: Reference to $_ during typeset
From: Bart Schaefer <[email-masked]>
To: [email-masked]
Cc: Sebastian Gniazdowski <[email-masked]>
Date: Thu, 9 Jun 2016 23:31:37 -0700
List-Id: Zsh Workers List <zsh-workers.zsh.org>

[Bringing this over from zsh-users]

On Jun 10,  8:12am, Sebastian Gniazdowski wrote:
} Subject: Re: Can $_ substitute $0 when nofunctionargzero
}
} It is little hard to understand. For example something works in following:
} 
} local var="I am $_"
} > I am local

That's a very strange definition of "works".

This began happening when local, typeset, et al. became keywords.  It
doesn't "work" in zsh prior to that, and it's probably a bug in this
case.  Zsh 5.0.3 (for example) shows the correct behavior:

torch% echo foo
foo
torch% local var="I am $_"
torch% print $var
I am foo

Whereas 5.1 is broken:

torch% echo foo
foo
torch% local var="I am $_"
torch% print $var
I am local

Probably this just shows how seldom $_ is used for anything at all.