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.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 23878 invoked from network); 27 Dec 2020 22:06:44 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 27 Dec 2020 22:06:44 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1609106804; b=iTyzRrRgrByOSZkLIt9OhHQLrZtxnkMZSFs5jhpnYoFMuDyAYv/RlKnEqeHk6DFMyAdDmog9xc C1Cwbq/i3wy9bzBJJIr+aYbs4LW3tFVmyjNQmImLKGQtT3N2sFQfqDg5C7kKDNuhUxACjBpvOs 4D/rSswLrZGOvSIkMDvS0eBcV/cJbbA5qUomWue913eEsbh0J1NrbJ96j7Uj7LOE9wjPbwwXRh gmCw1St34UFXSlKUhktuu2JniShqlYtdTIa3e+Fael45emRCMpyhRElH1SBZ77aoS8aCnrXIVD 22mQ9r2kr8LTp4+giFJCtKr79YgTgWGbrkDmq1jcnygWcQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-oo1-f52.google.com) smtp.remote-ip=209.85.161.52; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1609106804; bh=w0U7L0vsgVHmkx1AbjUFlE6Oon5G4bQKDdmMD/C6jSY=; 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=aDDcAmAi1Vzr+0ei+5PAZ3EPpf7V28UtS4lXnbBXlslPwQsIz4nhn5mn3pS0FIeu0BrQRRGIeY pBxPztKuaR9tQCcson4yU9kOfOwpnb7VaQj0d5CkuJDy/iHYxU7RwYKoRPBkXA+OKqO3paLB5A iLP0BRAcOwKa4I34ufJoSVRnNKZdpbNWjPqW35rnlFwYHrLlb8M3XvOFtUTN65vTGhUMKparK5 xXs16L6OZgRcpWzn6vBwXb/9F79TsA372E5y/hUwh9JAmpmCInYpYpjebyGQcUCZ7r7hm4SvEF XNJHD6vrd2dL/os2iGrI7o89LEPwA2/HXPRUe6SSMvxBcQ==; 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=HRCkgqv7rJRBtqpYooiMt/AHeNFkIjX12Fc9zi8alZc=; b=qp9rQPIzXraN7kVwv1nIZPo+Ke NCyYLYDcQiW2Hov86SkqZNJn7qOfIma1Wh8T4j3G95LsEMQueX8TS/EvG6zyQST0Y41yIBzSrZHpz PcVpsjnySD300Dxfd5/fK6M6rwGRJpQ0zGF2wBddyqLh/0bFqFL0TiRuLX9l1o3FBkHJdR3RRvdbB mrNwQAOHfBVjtM6XTeyz4vgS8TMpiWNjnngv342wBSqL69SX0ath6Wo62m4NN+Idzb5ZQw3PwhXtL u36/7UYXkyhHuxrC1PfvLv2v6Id27pvt9BpNo4TrsQDYsCK0uVwymfqKosZZwtLojOtBCWqmWR+gR W+EL3erQ==; Received: from authenticated user by zero.zsh.org with local id 1kteBX-000BnZ-VJ; Sun, 27 Dec 2020 22:06:44 +0000 Authentication-Results: zsh.org; iprev=pass (mail-oo1-f52.google.com) smtp.remote-ip=209.85.161.52; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-oo1-f52.google.com ([209.85.161.52]:46741) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1kteBI-000BfG-JI; Sun, 27 Dec 2020 22:06:30 +0000 Received: by mail-oo1-f52.google.com with SMTP id n127so1861737ooa.13 for ; Sun, 27 Dec 2020 14:06:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=HRCkgqv7rJRBtqpYooiMt/AHeNFkIjX12Fc9zi8alZc=; b=Wk9mksfBYIDwuwdFs55QGKxVaz//Ths/xkQX7DytAbD6HmX8jfDlTrXAzBFYe+R81s 3qn9Jr8U1aIMb+Mvbh2h9VegK0sfpCveK0pq1GmRI9LV58oTXbtWWmI5P4iZadhd3qrA t2yHa4u5f6mAkFrnpsj7c0Y0EC7IwCHDvDcssyp+auJKqQKP4uMJ4vxs9Y/6oC4WJG7Z X6l1nEQ14kyl6tIpBSoqk2ilJOU8wRbOTMRihiFtGFMB+3/34VclGhkbiF4m8F13JVuQ 1soPZzKECiEcPHl6aGm4qc3Umu5GAyHyb+aOcdGeyMo2LJ2tV3pTYuLRAihV96wme81K zipA== 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=HRCkgqv7rJRBtqpYooiMt/AHeNFkIjX12Fc9zi8alZc=; b=ifWKhxRtaAbZXgxSjV83PGe5l2BQylJ140tiNTIULiVizrIZknoDyVPpFA/+KsVVLJ ClRDoaW97e2mdQTsGqrYJScPCtm3x1u3uGg/3+EdMRlw8ynYTv6l3hQYnBB0FTtfFJ3L /f02nbSWwTVpxl40iabJKgurZ6ivp/46zBJQIbs8aFApyyMy+d2nZ0Q3SMC8KTajBJ4P 3M1Uami4SnKP7nBzG5ZN1s9jjGugvnl7uImvpUldzm9f7jcCqn4LWYfeQTHqvF+2PqoB HP7w+alY+1kzaECr609ZEkbFECMDa+BUztByJy2bDe2ddN9i999s5Q3t1j7wO/fFHFQ9 Q6+w== X-Gm-Message-State: AOAM531x/OyTmas08WmWTKAhs6coa261lXoDm2hGgjHXim4Seimv3Pho HfxFVnzc5wbvezCHR4UM6s9gmSL265fw83mLF5Zn1A== X-Google-Smtp-Source: ABdhPJwA03cdd1L024GjOvwhe45ntVFgS/DrarAJ++swKgTv521y8TxJzd/PrjzEQDH1F+3dk2uodxk/SqguGfFjzLQ= X-Received: by 2002:a4a:e294:: with SMTP id k20mr29219246oot.82.1609106787238; Sun, 27 Dec 2020 14:06:27 -0800 (PST) MIME-Version: 1.0 References: <20201223234711.492603-1-felipe.contreras@gmail.com> In-Reply-To: <20201223234711.492603-1-felipe.contreras@gmail.com> From: Bart Schaefer Date: Sun, 27 Dec 2020 14:06:15 -0800 Message-ID: Subject: Re: [PATCH] declarednull: felipec's approach To: Felipe Contreras Cc: "zsh-workers@zsh.org" Content-Type: text/plain; charset="UTF-8" X-Seq: 47762 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: On Wed, Dec 23, 2020 at 3:47 PM Felipe Contreras wrote: > > I added a test that shows a discrepancy I found (${(t)var}) but there > could be many, may more. I only checked one instance of PM_UNSET. Here's one that your patch gets (I think) wrong: ubuntu% setopt posixbuiltins ubuntu% () { function> readonly foo function> typeset -p foo function> print x${(t)foo}x function> } xx ubuntu% (Note "typeset -p" output nothing.) On declarednull without your patch: ubuntu% setopt posixbuiltins ubuntu% () { function> readonly foo function> typeset -p foo function> print x${(t)foo}x function> } typeset -g -r foo xx ubuntu% The typeset output probably comes down to your third hunk in Src/params.c (printparamnode), although I'm not certain what the correct fix is, and I don't know what's up with ${(t)foo}. The behavior with your patch changes if it's done this way: ubuntu% () { function> local foo function> readonly foo function> typeset -p foo function> print x${(t)foo}x function> } typeset -r foo xscalar-local-readonlyx ubuntu% More generally, I'm a little concerned by the vunset hunk in Src/subst.c. When working on declarednull, I tried a LOT of variations of fiddling with vunset without getting consistent behavior. I should have preserved them as test cases, but didn't because the "make check" suite was not passing everything anyway. Most involved things like ${+array[x]} for arrays and hashes. One other thing that has me scratching my head about your patch ... I can't see any reason why it matters that the bit value is (1<<30), but if I try, for example, overloading (1<<22) as I did for PM_DECLARED, the argument lists of shell functions stop working.