Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Yet another silly zsh-ism
- X-seq: zsh-workers 29470
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Yet another silly zsh-ism
- Date: Thu, 09 Jun 2011 09:16:11 -0700
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
I was thinking about the question of simulating anonymous functions in an
older version of zsh, and stumbled upon this: You can create a function
whose name is the empty string.
torch% setopt functionargzero
torch% ""() { print Hi, my name is ${(qqqq)0} }
torch% ''
Hi, my name is $''
torch% print $functions[]
print Hi, my name is ${(qqqq)0}
torch% typeset -f ""
'' () {
print Hi, my name is ${(qqqq)0}
}
Other shells complain that the empty string is not a valid identifier.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author