zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: Anonymous function syntax and "sh" emulation
Date: Fri, 21 Aug 2015 08:29:23 -0700	[thread overview]
Message-ID: <150821082923.ZM11413@torch.brasslantern.com> (raw)
In-Reply-To: <20150821155249.3f773977@pwslap01u.europe.root.pri>

On Aug 21,  3:52pm, Peter Stephenson wrote:
}
} What's worried me is the other part of the effect, which isn't specific
} to sh emulation, which is that the first word after "function" is
} treated as not a command word, while the remaining words are treated as
} command words:
} 
} I would hazard a guess this is a bad thing, which hasn't been noticed
} because multiple words after "function" aren't very common.

This is especially interesting in that exactly the opposite happens when
defining multiple functions WITHOUT the "function" keyword:

torch% alias first='fn1 fn2' second='fn3 fn4'
torch% first second () { print $0 }
torch% functions
fn1 () {
        print $0
}
fn2 () {
        print $0
}
second () {
        print $0
}


} I suspect we can just move the "incmdpos = 1" until after we've found
} something that is either not a STRING or a possibly tokenized "{".  Not
} included in the patch below, but I'll do it unless anyone contradicts.

I would say that prefixing with "function" is a good workaround for the
function/alias conflict (maybe even update FAQ 2.3 to describe this),
so it is good if none of the words are treated as command aliases.


  reply	other threads:[~2015-08-21 15:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-21  4:16 Bart Schaefer
2015-08-21 14:52 ` Peter Stephenson
2015-08-21 15:29   ` Bart Schaefer [this message]
2015-08-21 16:03     ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=150821082923.ZM11413@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).