From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29313 invoked by alias); 14 Jun 2015 06:00:44 -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: 35464 Received: (qmail 1599 invoked from network); 14 Jun 2015 06:00:41 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=MBfblyto1mvdSklQG2jycj5MmUA/MGI7uay7fglIb/A=; b=qSleLObMJMU1jj7630FxuJBOSYi8AI3+7mINC3zIhJM0ya2mi3EkvTllPhtdqNR4eX w0jS9y7uYzNozZq3MxAVrDW8msrqlngqzoKHjoCacQp4a8rF539+lCi1HhjcYb3aSZxC l8wpndk/XWMBMrJSDV3LDHIFuDH6MVZk1tK51spLvoH0xmooQdVCKPHgQ0mEZFlj97Ku jlKEaAPqd1zI9PRyMmCI1it8w0so086P2kKnWKX6J5z+SvrfOf6pMWDlcEfc/a8jag07 AxxDjPjnRf6PICtKDgbicfiKf+HjjnD5zxnWv/GCQpg6570spigE2hMwAwoPfWQlYiBR To7Q== MIME-Version: 1.0 X-Received: by 10.43.151.83 with SMTP id kr19mr24044838icc.3.1434261634203; Sat, 13 Jun 2015 23:00:34 -0700 (PDT) In-Reply-To: <150613165827.ZM29680@torch.brasslantern.com> References: <150613165827.ZM29680@torch.brasslantern.com> Date: Sun, 14 Jun 2015 08:00:34 +0200 Message-ID: Subject: Re: Can't overwrite $0 in functions anymore From: Mikael Magnusson To: Bart Schaefer Cc: zsh workers Content-Type: text/plain; charset=UTF-8 On Sun, Jun 14, 2015 at 1:58 AM, Bart Schaefer wrote: > On Jun 14, 1:05am, Mikael Magnusson wrote: > } > } Is this an intended change? > > Hm. Sort of. It's a side-effect of implementing POSIX_ARGZERO. > > With POSIX_ARGZERO set, $0 must always contain the name used to invoke > the shell. If POSIX_ARGZERO changes from set to not set, $0 has to be > restored as specified by the (on or off) setting of FUNCTION_ARGZERO. > > Consequently the value of $0 became fixed for both cases; assignments > to it are no-ops. > > However, you can still change the value of $0 by hiding the special: > > torch% () { local -h 0=hello; echo $0 } > hello Ah, I see. I was only using it in a single helper function out of laziness, precisely because it let me leave out a local statement. :) -- Mikael Magnusson