zsh-users
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-users@zsh.org
Subject: Re: Feature request: a new warning option
Date: Wed, 9 Oct 2019 17:36:07 +0000	[thread overview]
Message-ID: <20191009173607.rkvblvhq7vnoanya@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <CAN=4vMpjCWOF24ybeyN79EsCxaV6POjn85Vhf3n8BdcLE2g7rQ@mail.gmail.com>

Roman Perepelitsa wrote on Wed, Oct 09, 2019 at 15:40:48 +0200:
> Supposing that "if-then-else is too verbose" is a problem that
> warrants extending zsh, a natural solution would be to provide an
> alternative syntax for the same construct. Something analogous to
> `x ? y : z` from C and other languages derived from it.

Extending the SHORT_LOOPS form of «if» to allow an «else» comes to mind, but
I'm honestly not sure if it'd be a good change to make.

> Note that C had an extra reason besides terseness to introduce this
> syntax: if-then-else is a statement while the ternary is an
> expression. This reason doesn't apply to zsh, which leaves saving
> on typing as the only benefit of the contemplated innovation.
> Since `x ? y : z` already has a meaning in zsh, the new syntax would
> have to be different and likely unfamiliar to users.
> 
> All-in-all, doesn't seem worth the trouble. if-then-else has the
> desired semantics, isn't more verbose than in other languages,
> and is easy to read even for people unfamiliar with zsh.

Cheers,

Daniel

  reply	other threads:[~2019-10-09 17:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-09  4:02 Sebastian Gniazdowski
2019-10-09  8:45 ` Roman Perepelitsa
2019-10-09  8:49   ` Peter Stephenson
2019-10-09 11:56   ` Sebastian Gniazdowski
2019-10-09 12:08     ` Roman Perepelitsa
2019-10-09 13:17       ` Sebastian Gniazdowski
2019-10-09 13:24         ` Peter Stephenson
2019-10-09 13:41           ` Sebastian Gniazdowski
2019-10-09 14:07             ` Ray Andrews
2019-10-09 15:19               ` Peter Stephenson
     [not found]           ` <CAKc7PVBQnt_ZE3X=8gz5R_VURwaTL3mDL=X-7H__yYqAjvXoWA__41912.055101578$1570628583$gmane$org@mail.gmail.com>
2019-10-09 14:04             ` Stephane Chazelas
2019-10-09 13:40         ` Roman Perepelitsa
2019-10-09 17:36           ` Daniel Shahaf [this message]
2019-10-09 18:15 ` Bart Schaefer
2019-10-10  3:29   ` Sebastian Gniazdowski

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=20191009173607.rkvblvhq7vnoanya@tarpaulin.shahaf.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=zsh-users@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).