From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17723 invoked by alias); 3 Mar 2016 09:37:10 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 38075 Received: (qmail 16947 invoked from network); 3 Mar 2016 09:37:08 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-AuditID: cbfec7f4-f79026d00000418a-1a-56d805c0cf01 Date: Thu, 03 Mar 2016 09:37:02 +0000 From: Peter Stephenson To: zsh-workers@zsh.org Subject: Re: ZSH_SCRIPT Message-id: <20160303093702.7d28f80e@pwslap01u.europe.root.pri> In-reply-to: <871t7s7ev6.fsf@lwm.klanderman.net> References: <22221.59800.803540.618862@lwm.klanderman.net> <160224143153.ZM28994@torch.brasslantern.com> <20160225093344.0d2499d5@pwslap01u.europe.root.pri> <87r3g08ycp.fsf@lwm.klanderman.net> <160225150425.ZM14095@torch.brasslantern.com> <87lh6384y5.fsf@lwm.klanderman.net> <20160301092746.1472ae95@pwslap01u.europe.root.pri> <87fuwa8dpk.fsf@lwm.klanderman.net> <20160301150707.2ee18f01@pwslap01u.europe.root.pri> <56D74063.6020202@inlv.org> <871t7s7ev6.fsf@lwm.klanderman.net> Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrILMWRmVeSWpSXmKPExsVy+t/xK7oHWG+EGUy+pWtxsPkhkwOjx6qD H5gCGKO4bFJSczLLUov07RK4Mn4++8hasJenomXFKZYGxlucXYycHBICJhK/L19jgrDFJC7c W8/WxcjFISSwlFFi1/ubUM4MJonenbeYIZzTjBL3N72BypxhlHg1+QM7SD+LgKrEjnMXwGw2 AUOJqZtmM4LYIgLiEmfXnmcBsYWB7IsfZgLVcHDwCthLPFvNDxLmFDCQOPt9BxPEzA/MEj8m nwXr5RfQl7j69xPUffYSM6+cAYvzCggC1dwDm8ksoCWxeVsTK4QtL7F5zVtmEFtIQF3ixt3d 7BMYhWchaZmFpGUWkpYFjMyrGEVTS5MLipPScw31ihNzi0vz0vWS83M3MUIC+ssOxsXHrA4x CnAwKvHw3mi4HibEmlhWXJl7iFGCg1lJhHcz840wId6UxMqq1KL8+KLSnNTiQ4zSHCxK4rxz d70PERJITyxJzU5NLUgtgskycXBKNTBq3jr5vJh/841Cbw8+LrHtekHFVxVK3rdp1F0q4LT1 8yj5wT9jasfq5OOnip1lfFYE9l+xXbj29T4PsyDj1dc7JiRqvvDX31mz3K7H7t2M8KDTW8zj u+u3JEWviDO0kN3cctJ+wdLDm9UqWQM905X7spo4fnToX3z00z/s7JzLhxIOTdZiZlFiKc5I NNRiLipOBAAFD8EbZAIAAA== On Wed, 2 Mar 2016 16:24:13 -0500 Greg Klanderman wrote: > >>>>> On March 2, 2016 Martijn Dekker 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