zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: PATCH: expanding parameters like echo/print builtins
Date: Sat, 14 May 2011 11:41:04 -0700	[thread overview]
Message-ID: <110514114104.ZM14616@torch.brasslantern.com> (raw)
In-Reply-To: <20110514114156.GA12539@stack.nl>

On May 14,  1:41pm, Jilles Tjoelker wrote:
} Subject: Re: PATCH: expanding parameters like echo/print builtins
}
} > [${(g)parameter} expansion for expanding like echo/print]
} 
} Am I really strange in thinking this should really be done using command
} substitution of echo, print or printf with appropriate options?

A lot of features added to zsh are things that could be done another
way but that it's more convenient to have a shortcut.

E.g., one could argue that $((5 + 3)) should really be done using
$(expr 5 + 3), etc.

} Admittedly, this requires precautions if trailing newlines are
} significant [...]
} Other tricks are using eval with $'...' (requires special care for '
} and is not in POSIX.1-2008).

It's often precisely to avoid those precautions and "special care"
cases that things like (g) get introduced.
 
} In general, I think the ${(foo)parameter} forms are mostly write-only
} code for interactive use, except perhaps if you use them a lot.

I think you've got that exactly backward. :-)  If these forms were
primarily for interactive use, the syntax would probably be a lot
less convoluted.  $'...' is for interactive use.  ${(g:oe:)...}, not
so much.


  reply	other threads:[~2011-05-14 18:41 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-14 11:41 Jilles Tjoelker
2011-05-14 18:41 ` Bart Schaefer [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-05-11 13:02 Mikael Magnusson
2011-05-11 15:03 ` Bart Schaefer
2011-05-11 15:14   ` Mikael Magnusson
2011-05-11 16:03     ` Bart Schaefer
2011-05-11 16:22       ` Mikael Magnusson
2011-05-11 16:48         ` Bart Schaefer
2011-05-11 17:11           ` Mikael Magnusson
2011-05-11 15:47   ` Oliver Kiddle
2011-05-11 16:21 ` Peter Stephenson
2011-05-11 16:38   ` Mikael Magnusson
2011-05-11 17:07     ` Peter Stephenson
2011-05-11 17:19       ` Mikael Magnusson
2011-05-11 17:26         ` Peter Stephenson
2011-05-11 17:35           ` Mikael Magnusson
2011-05-11 17:43           ` Mikael Magnusson
2011-05-12 10:10             ` Bart Schaefer
2011-05-12 10:40               ` Mikael Magnusson
2011-05-12 14:04                 ` Bart Schaefer

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=110514114104.ZM14616@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).