zsh-workers
 help / color / mirror / code / Atom feed
* Anonymous function syntax and "sh" emulation
@ 2015-08-21  4:16 Bart Schaefer
  2015-08-21 14:52 ` Peter Stephenson
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2015-08-21  4:16 UTC (permalink / raw)
  To: zsh-workers

This works in both zsh and sh emulation:

  () { print hello; }

So does this:

  function () { print hello; }

This works in zsh emulation but not in sh emulation:

  function { print hello; }

The error is "parse error near `}'".  If you write it as

  function {
    print hello
  }

then the error is "parse error near `print'".  Since this is the example
syntax in the "Anonymous Functions" subsection of the manual, it seems
that it either ought to work, or there ought to be a warning.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-08-21 16:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-21  4:16 Anonymous function syntax and "sh" emulation Bart Schaefer
2015-08-21 14:52 ` Peter Stephenson
2015-08-21 15:29   ` Bart Schaefer
2015-08-21 16:03     ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).