zsh-workers
 help / color / mirror / code / Atom feed
From: Mitchell Gildenberg <mgild@google.com>
To: zsh-workers@zsh.org
Subject: zsh function declaration bug
Date: Wed, 30 Jan 2019 09:46:02 -0800	[thread overview]
Message-ID: <CAOQ4iAAW7g18YbvH1v2oLNxx4z7jh-5PaR-oWq-j4Mp-FieR+g@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1090 bytes --]

Hello,

I noticed some interesting behavior when declaring zsh functions without
specifying the `function` keyword. When I declare a function that is a
prefix of some other item in my path or another alias, the function that is
a prefix is called instead.  For example:

------------
(macbook) ➜ mgild $ zsh --version
zsh 5.3 (x86_64-apple-darwin17.0)
(macbook) ➜ mgild $ ls
Applications/ Desktop/      Documents/    Downloads/    Library/
Movies/       Music/        Pictures/     Public/
(macbook) ➜ mgild $ l(){echo "hello"}
(macbook) ➜ mgild $ ls
hello
(macbook) ➜ mgild $
-------------- (zsh 5.5 exhibits different behavior)
➜ mgild $ zsh --version
zsh 5.5 (x86_64-debian-linux-gnu)
➜ mgild $ ls
Desktop Documents
➜ mgild $ l(){ echo "hello"}
zsh: defining function based on alias `ls'
zsh: parse error near `()'
--------------
zsh 5.5 seems to exhibit different behavior, but it is still unexpectedly
failing to create the function.

Let me know if any more information is required.

Thank you.

Mitchell Gildenberg
mgild@google.com

             reply	other threads:[~2019-01-30 17:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-30 17:46 Mitchell Gildenberg [this message]
2019-01-31 13:11 ` dana
2019-01-31 14:00   ` 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=CAOQ4iAAW7g18YbvH1v2oLNxx4z7jh-5PaR-oWq-j4Mp-FieR+g@mail.gmail.com \
    --to=mgild@google.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).