From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 21254 invoked from network); 23 Dec 2020 23:00:58 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 23 Dec 2020 23:00:58 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1608764458; b=cp/elo/036eJgMb89wUzkekNFT/xBn8pyyvkoOC+gJlE6qfTEUWaOCVHtZx2ts+S7njrLWhBWT CLNuWkwtUiDEvEgyTFfQByg/+dCeQkp/fPEK5zzMGFPIhGqOmuM35pk6MDGW0re1oJqQfyTNNq VylCkvYgUhIL0JnxhDeakJK3bg4286Rb5BURkVYEgiGXLwxvvP2cIlPsYziIvSsK4ozQUMfEt9 4Mb2maYXjA+zgOFTqK7/K7KNXbCOkLt4GtZtAj3+phpAG9joA59/XbUcgMRmvmqSUt3dSnznD1 5giJ4NSGVLeTTUn5NZ9ekXupIaJR4B7EyPbfY0mBnxYIZQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-wr1-f52.google.com) smtp.remote-ip=209.85.221.52; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1608764458; bh=dK2vW5dfk1md7QFWV5HW+E6Xo8fLDt4XKKSJFGqG3NM=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=PwzM982Irlp7qH1IBngxbaDWF3+fG03x9LfHfUQYbTRGJznUjLSKMAg9PBHUvJWLCtxkThpjPW N78lSrs4qevY/VJg/lWqO+i5q4NKzi+tM+d/Jn183WNp/NRBK+1IdmRDMsMcewPV51SJkPphVo BUBMEn9vVm4sC/RL8RG/VnrPSlPtqEYZCNyUU7/w0aRPPgLpkrgGg8bfUMWD1Vr7g7JvczmEem 3x4xpxYa03OQy5xMruFnfsOV8Ir+tdDlilNBjQk4P6qj5OBBhHwKdlRI7iK4uU/hRbW//F44ME FplF6RBIqWRJFO+dyrtaBypJwhH+z+NzBU3d2IOirGvd3w==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=S7+mlrZGrufLIi/UqxF53A5l/eBkrD5GN2Oxukw07xU=; b=snQ4xIWlT04fMYGTV83TSlIcUV inUaXHTlmklqqjKVWoMh5X7QkstuZphGsV4eg8w6ZwmJ9Ade0dbfIQjYFQ2wKIw1050mVE3bQntnt iH8/wH1oPEgy+24P+PMjJrrqcBOpi6aoF8wlTWzcayIYpxneg0e2WLloOOqP+uJ3Ui4dHI4dQS+G0 Beo39jorwMBw9vj3ybb7cZK1R92pNAaDHOrpG7G5PA6lVFOZXalwZzD1dvEMJAeqoszzgmIbZ+gBp HNnHEIXVHoSe8SaMFZN5Lckn438FJ0VJJNC8i8xBec0hkvjM9RWkSro12tq5KouqoGy5dUlIPeQE/ incwj3lA==; Received: from authenticated user by zero.zsh.org with local id 1ksD7o-0002ES-EF; Wed, 23 Dec 2020 23:00:56 +0000 Authentication-Results: zsh.org; iprev=pass (mail-wr1-f52.google.com) smtp.remote-ip=209.85.221.52; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-wr1-f52.google.com ([209.85.221.52]:41655) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1ksD7V-00025K-Qd; Wed, 23 Dec 2020 23:00:38 +0000 Received: by mail-wr1-f52.google.com with SMTP id a12so634916wrv.8 for ; Wed, 23 Dec 2020 15:00:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=S7+mlrZGrufLIi/UqxF53A5l/eBkrD5GN2Oxukw07xU=; b=Ai88Lm+IJulbwACp+i+vTsQ7RFKKKhI0aOL9GzByqdePcVrTPLRU4AOJsGFykzT0Ix UpAWXMLQh7AUpegk33LtZWaspqRJX+5fhJ3ZTLihuNHky4RtnrdEVH1swPZ9GpZYNyHR DyWmZJ3D1gkPpGpGELmhxUPJPYa0Gq4HshNjRH66IO7JRCFe7KF1G7XuCpM3C2B2QKn2 ZAebJFXl/G7luoqp6BVldoBVTSZdenCvFvRwSg9QeTtQdmYLlkS85Bbv/VXifEq+nmPY VC0andmLc82LIO6XzCssAEP9fTQqKpXC/6eyIL/tskK2eI6y2jOFPpOQkEln7SsFLZRM IKEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=S7+mlrZGrufLIi/UqxF53A5l/eBkrD5GN2Oxukw07xU=; b=Ofiwhyo5YFLYHDvekFVk9VyTTJp0SLmD2gbWUumP8eB0yEi/uaszMEX2YN1u5C2ic0 T+72npKLHsfmH331bx61Bq8qu1YDW9L0ooLifSjMIfAXdEA80A5TLljYxpAXHO/D7Fz8 usCQtnpM1XQzza2thjYa1Ga+YQ3nufzli4Tz+YTD8EbA5b/OHCPg1y7W8++ofSccXlGH 8L+Hvc+EHD/yIrH0DNAyUr38cEBRJFkc+qOSrEso+vi6ZYE4oqSbTO7TsAeHBfvWhBXl BXV2dPWNq5HGPXI4BOUSsgjHZ4Y8vhq7PRgP5i1bwmHRF6d66VvJ2hR72esdkY2hSw8u gGWg== X-Gm-Message-State: AOAM533ddQkxc/lugPP5u3wdUBJicZjS4VlM+Bleyz6bx5Y/MI1iCr7S V7GCR3m7fLLg/xNSYaxrI0NSz3xKOKnXQz7N3zPCXGANEojqyg== X-Google-Smtp-Source: ABdhPJz2XvLYBYhEsmV+nCE9CGbvuMpTBRtu3dBhiamKEDRM+UPG4ZX8EUIfrwNc+ndc7wudMIZcbafGlxSEgb05Z8Q= X-Received: by 2002:adf:ce90:: with SMTP id r16mr31940451wrn.100.1608764437133; Wed, 23 Dec 2020 15:00:37 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Felipe Contreras Date: Wed, 23 Dec 2020 17:00:25 -0600 Message-ID: Subject: Re: One possible answer to typeset vs. unset To: Bart Schaefer Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 47755 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Archived-At: Hello Bart, Sorry about the delay, I've been busy with other projects. I merged my approach and your approach and I'll be sending a patch to show the resulting differences. On Fri, Dec 4, 2020 at 6:52 PM Bart Schaefer wrote: > On Fri, Dec 4, 2020 at 3:04 AM Felipe Contreras > wrote: > > > > Next, I think all the instances in which PM_UNSET is checked should be > > verified, to see if PM_DECLAREDNULL makes sense in those. I'll do > > that. > > In cases I've discovered so far, it's actually more likely that one > has to check whether PM_UNSET and PM_DECLARED are boolean different, > rather than whether both are (not) set. Literally the first instance of PM_USET I checked shows a discrepancy between my approach and your approach. f () { local var print ${(t)var} } f With my approach this prints "scalar-local" (I think correctly). With your approach it doesn't print anything. > > And I think that's it. All that's left is deciding what flag would > > turn this mode on. > > I'm leaning toward POSIXBUILTINS. Would ksh emulation enable this flag? > > Lastly, I don't know if there is any low-hanging fruit, for example; > > doing the same as bash 5.0 with localvar_inherit and localvar_unset. > > I thoroughly dislike localvar_inherit. I wonder if it's in bash 5.0 > just to be able to compare the suggested semantics from that rejected > POSIX proposal we've previously discussed. I may be biased by long > use of the zsh semantic, but treating global -> local like environ -> > global seems weird, unless there's also a way to "export" a local back > to global. After considering it further I don't think it makes sense to have this as default. No other language does something like that. > > I don't quite get localvar_unset, but seems to also be a sensible default. > > If I'm reading the bash manual correctly, localvar_unset means that > "unset foo" behaves like "local foo; unset foo". Thus (Chet will > probably correct me): If so I don't think it makes sense to have this as default. -- Felipe Contreras