zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-workers@zsh.org
Subject: Re: ZSH_SCRIPT
Date: Thu, 03 Mar 2016 09:37:02 +0000	[thread overview]
Message-ID: <20160303093702.7d28f80e@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <871t7s7ev6.fsf@lwm.klanderman.net>

On Wed, 2 Mar 2016 16:24:13 -0500
Greg Klanderman <gak@klanderman.net> wrote:
> >>>>> On March 2, 2016 Martijn Dekker <martijn@inlv.org> wrote:
> 
> > Is there a particular reason why it should be empty rather than unset?
> > Unset seems more logical; if we're not running a script, the script name
> > is not the empty string but it doesn't exist. This would also make it
> > possible to do
> > 	[[ -v ZSH_SCRIPT ]]
> > to check if you're in a script.
> 
> Hi Martijn, I'm happy to do it either way, but went with what had
> been discussed about 5 years ago when both Bart and Peter seemed to
> prefer empty to unset:
> 
> http://www.zsh.org/mla/workers/2011/msg00183.html
> 
> Bart> I think empty is OK, but let's hear from PWS.
> 
> PWS> I think empty is much more Zen-like, so fits perfectly.
> 
> Bart and Peter, can you let me know if that still holds?

I don't think we ever had a major preference.

The only real objection to it being unset is an error is if you test

[[ -z $ZSH_SCRIPT ]]

and NO_UNSET is set.  This is much more likely for a zsh programmer than
the rarely used -v.  On the other hand, ${+ZSH_SCRIPT} is a standard zsh
idiom which is quite widely used.  However, as it's a new variable, it
really doesn't matter that much as long as it's documented.

There's a rather minor objection that if it's not set in a shell
function you might think the shell never sets it and use it yourself.
But programming by assumption isn't very healthy.

I can't think of anything else.  So I really don't think it makes a lot
of difference.

pws


  reply	other threads:[~2016-03-03  9:37 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-24 17:34 ZSH_SCRIPT Greg Klanderman
2016-02-24 22:31 ` ZSH_SCRIPT Bart Schaefer
2016-02-25  9:33   ` ZSH_SCRIPT Peter Stephenson
2016-02-25 17:59     ` ZSH_SCRIPT Greg Klanderman
2016-02-25 23:04       ` ZSH_SCRIPT Bart Schaefer
2016-02-29 23:36         ` ZSH_SCRIPT Greg Klanderman
2016-03-01  9:27           ` ZSH_SCRIPT Peter Stephenson
2016-03-01 14:39             ` ZSH_SCRIPT Greg Klanderman
2016-03-01 15:07               ` ZSH_SCRIPT Peter Stephenson
2016-03-01 16:36                 ` ZSH_SCRIPT Greg Klanderman
2016-03-01 18:36                   ` ZSH_SCRIPT Bart Schaefer
2016-03-01 20:14                     ` ZSH_SCRIPT Greg Klanderman
2016-03-02  9:30                       ` ZSH_SCRIPT Peter Stephenson
2016-03-02 15:48                         ` ZSH_SCRIPT Greg Klanderman
2016-03-02 15:56                           ` ZSH_SCRIPT Peter Stephenson
2016-03-02 21:33                             ` ZSH_SCRIPT Greg Klanderman
2016-03-02 19:34                 ` ZSH_SCRIPT Martijn Dekker
2016-03-02 21:24                   ` ZSH_SCRIPT Greg Klanderman
2016-03-03  9:37                     ` Peter Stephenson [this message]
2016-03-03 17:26                       ` ZSH_SCRIPT Greg Klanderman
2016-03-03 17:37                         ` ZSH_SCRIPT Peter Stephenson
2016-03-03 19:36                           ` ZSH_SCRIPT Greg Klanderman
2016-03-03 20:39                             ` ZSH_SCRIPT Peter Stephenson
2016-03-03 20:44                             ` ZSH_SCRIPT Bart Schaefer
2016-03-03 20:50                               ` ZSH_SCRIPT Bart Schaefer
2016-03-04  2:07                                 ` ZSH_SCRIPT Greg Klanderman
2016-03-05 16:22                                   ` ZSH_SCRIPT Bart Schaefer
2016-03-05 20:03                                     ` ZSH_SCRIPT Greg Klanderman

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=20160303093702.7d28f80e@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.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).