From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26704 invoked by alias); 3 Jan 2016 19:21:31 -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: 37500 Received: (qmail 9443 invoked from network); 3 Jan 2016 19:21:30 -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=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version:content-type; bh=icRi3uceX8qrKSYOEEzTGjTW68D/t44jrM20LS0095g=; b=clb+WvgmM/fqv+TUBeTiBPPpsLTgRaY51DNpoGkOMithQc38WqXsZAU/u980NG49oF +SmLE2TCKDNMoqxh3XZ6KSHJgQmjeIeA6XKipoeUjoctt3d6sUVc8Dt6vCZyx4Y7OchY F1gj5rU8aAcjntAgzCDZRhcC3dZ6gz1CgZ8M2kj4L+k3G++jAt2QBJToTrkgwV39GAwG puyb46GtpoESdsu0nzdOeXWUsXjShZB0W066XuWJm7CvGS2ztThmm+v8JzyEMSTCyGjd N51QuC87vWAngzIzYO66dM9pF9vtLy+ueEDnrLSiyd3xDQ6Ke0JaHA/R9fLO3/F9BcKJ yp5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version:content-type; bh=icRi3uceX8qrKSYOEEzTGjTW68D/t44jrM20LS0095g=; b=Pq51lg80KK/EdF8uL2KE5fFunMR2MrxnGdFuIWYWdu/Y0HX/7vFUMNGPYbBbDAUzp8 nW8TOKYY1D6sB5h2YxHhuGCOSOi/2LUOgTa+EpVV6VpmRYrKruQscfGzlwmDRK3i8W66 M8VW1YA8Bv2MLn9vjC6pi2iwa5pJatTsY1/1EHru7ZWl/vsLAEDz+hm4t3owKNyrFnwR HTRkiC9CJvPfbO+aBAlM3dOLO9UcmtUJcoSAs1TkmXNyM10sgFNmGTvf8GFKzI0t2qDQ /n6yVYc/8gD5GVbJdG9Y/Vje0yFsAboAdAv32BWZDIVui+A95tkMKiSZIreth1ptnj18 1OBA== X-Gm-Message-State: ALoCoQlXHzdHI0sWdM4IiGH1AZV8REPZi9Bps09pBXNRYylRPca9Th6SxAzxXdVUBDktMZjtG5RoUjS5u4CvFadX86T5MAlfJw== X-Received: by 10.98.8.82 with SMTP id c79mr99105319pfd.122.1451848887542; Sun, 03 Jan 2016 11:21:27 -0800 (PST) From: Bart Schaefer Message-Id: <160103112125.ZM12920@torch.brasslantern.com> Date: Sun, 3 Jan 2016 11:21:25 -0800 In-Reply-To: <20160103190031.24249cf5@ntlworld.com> Comments: In reply to Peter Stephenson "Re: [BUG] functions can't create global readonly variables" (Jan 3, 7:00pm) References: <56874393.1010001@inlv.org> <160101202710.ZM1896@torch.brasslantern.com> <20160102181814.3ac8d578@ntlworld.com> <160102123639.ZM16270@torch.brasslantern.com> <20160103190031.24249cf5@ntlworld.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: [BUG] functions can't create global readonly variables MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Jan 3, 7:00pm, Peter Stephenson wrote: } } $ readonly foo=empty } $ fn() { local foo=bar; echo $foo; } } $ fn } bash: local: foo: readonly variable } empty I suppose if you consider locality to be a property of the variable, then making the variable readonly means you can't change that property. Fortunately readonly in a nested function, where the name is declared local in the outer function, does work like zsh's "typeset -gr" and does not force the readonly into truly global scope.