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 7692 invoked from network); 2 Dec 2020 21:59:38 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 2 Dec 2020 21:59:38 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1606946378; b=CiwRSkp1PESkObU6VHZlkVo79x87kGU+WTm7Fsgi7/4yl7fWH3FTnyNPkvIk3b5J7TsIEmpqQG 8AvW19w/YBcYa3m37FcbQYpyNTuWSG260HHNAJ5wqrYPbGoqznmwkiks6bxCJ3kSHV4jcpcgOU kqQqByvtVJjR/EOUyttpYBT0JJRvBgtVbOurXWtrvMraY/AWKyZiYVvrKdvXV+/SQNQDagWcTw 4pt+NWJg0nPs2rxys8jKKS4r7cLWU/31nHJqImTxGrHrx7VhExaD5CzeCc1lwc4SQ7TiLOCYaZ S8GJBWX/zTYaSNGBR12dqvBo2EB1J4x1xFVC9PIbnUmXhA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-wr1-f48.google.com) smtp.remote-ip=209.85.221.48; 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=1606946378; bh=Z90iMSTt6OkN2D1dwhCPbgthPx0mp+i+VOa12/lTZhY=; 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=FI8b1UWTl59d5p8OOUlHCpSlEHPRu1po4f+R0NIaElwVi6cUrQmFyKvZ7WjvA//XiAh8rF9nyn zW2g3ksso85jcDM6AoTihp5j0Yf/bz8YufxBZW9YN845QIgupORn2xLaypfkNaoCGShhbIs4Mh 2r0us/9kDLTr4PW9W5mBUxKA/nqBn5BjU8GBuBWNlmHQA7J3d0d3SWXLXb/+NNCmQbhaWx8exz 5oXhF9CPtNa4cUoWVInHpYRgz7n5oUXiCmVx6ucATAavq68j0U/22bmnvtvyVIZb4RRMBArbwD hOEsX/exn7SFdh3aFSZInugthusGf4jrH5FPB3nyoSpXYA==; 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=f1sJtngk76TzgDYClDchHiD5sSF7KnW1EGc5BvDtZhE=; b=O0pikvZnj0+mp/dRoKygq84611 6uHoVf/YOl1vZaD/ux6cW5P8M2C7VZWch5F3ZLGDg3Y4Kzjj/FZbWX/2+Nzwas705YYD+2wsbR75o lDnoJ/clb+V4qf65COyl35Ixluv5zSEF6wZsOFApLDdQfIktVCfAQgFmVvRj6A8O4avZauCryWNW3 L8621FH4NaqdxIzYN+qdTb2jcV7FRR0Ve3OaTkbVB2mmH8vE6isIdIXbyYENEiMaT759JCLqBpbEg fZQow5eUMWL78CYPXAR6LY31a2+QXPPvX8Qd1vLsy6ATmFeK1h+yMvfI7bbHk60yHkwj/PbrVUJcB ElH/bAGw==; Received: from authenticated user by zero.zsh.org with local id 1kka9w-000NrJ-M4; Wed, 02 Dec 2020 21:59:36 +0000 Authentication-Results: zsh.org; iprev=pass (mail-wr1-f48.google.com) smtp.remote-ip=209.85.221.48; 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-f48.google.com ([209.85.221.48]:43401) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1kka9g-000Nhc-Qz; Wed, 02 Dec 2020 21:59:22 +0000 Received: by mail-wr1-f48.google.com with SMTP id s8so5672432wrw.10 for ; Wed, 02 Dec 2020 13:59:20 -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=f1sJtngk76TzgDYClDchHiD5sSF7KnW1EGc5BvDtZhE=; b=T02IQNDjtNxHd89GGMocnAtJSFJz707FQyVcg+3QNb2R337XYW5JZrGjbrJZdSKlw7 cUElcqm1cOs/tBDSRIhFsijnt5gDYDX0++Y5QKOzOlATZZkHaZS81Q7XVTKdlufo6Tif hr62syRLG/TV1vDTN+Rbq8Lq1vLjRV80WXvGkmDi2lbgYnvOHmODGeJMmA7/4Ad4pZ27 nwLxvOlRvf1fmpllS1UPn6blf/dQXQhQFx2HPNwiyus/EFaTJQEpx9pjwKsZHrN88caq LC5AZB4AWC2KAGVN0kEFUjqCvJGr/YY9rcvSAZH3cCFW6MvwD+EO0zG5w+kkJoxPFZnT Z3fQ== 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=f1sJtngk76TzgDYClDchHiD5sSF7KnW1EGc5BvDtZhE=; b=XmMSMlyleORFlTv0yi+KXwv2QSDqwMwRcqskAhm2Xf1UesiQTvvugSgGgmWsW4qDuQ jIQApnQoekci5BYmpWh2pg0avaud9GTqvLUPwuNuE0ntR8u//1/HWQfy0sAlGE7+O2pi 9NGWoJyIU9IvOuhhifj2dFNPJ63/qc5e2MuvY8+qaL2EjQtrgyoLnTpNz7JK/53ibdFi idr3RF+uUT6bRAV4eIiCCKyGoZekuN1FjhxJqQnQQBxFdk9ZlWKyagvgKDXWJf8KHBxO YihSZDzgFiq6QS9rDRCTKDkDpyjB+IUgaJe76BXHxXm2xE+8fZCv3IxwjuTLpX7SjWpW aG0g== X-Gm-Message-State: AOAM533xJMBuYWv+lVz9NVpDqJ0oTla9emTczcNASOi+ljjLwmmWpUYK V1JhAAzDgz8HIEfwOujG4Kg8Q5dyWn9kFdlUyndwCJtwUw+XWw== X-Google-Smtp-Source: ABdhPJyvhtd//xht5eVPZbRfyX6EaYfhqGP/aOpc2OleBYxjUItTJnE5Wv/DAIjwLPF8OrWkEIPK6LFtBlFSjjdWccU= X-Received: by 2002:a5d:4349:: with SMTP id u9mr120741wrr.319.1606946360095; Wed, 02 Dec 2020 13:59:20 -0800 (PST) MIME-Version: 1.0 References: <20201201091342.310763-1-felipe.contreras@gmail.com> In-Reply-To: From: Felipe Contreras Date: Wed, 2 Dec 2020 15:59:09 -0600 Message-ID: Subject: Re: [PATCH] First try of null typeset To: Bart Schaefer Cc: "zsh-workers@zsh.org" Content-Type: text/plain; charset="UTF-8" X-Seq: 47715 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 2, 2020 at 12:48 PM Bart Schaefer wrote: > On Tue, Dec 1, 2020 at 1:13 AM Felipe Contreras > wrote: > > > > This achieves most of what Bart Schaefer's version achieves, except no extra hacks are needed, and > > integer and floats are not changed. > > Applying the change to integers and floats is one of the reasons I > went in the direction I did. Yes, I suspect that's the way it will eventually have to be done, but others argued "typeset -i var" should initialize it to 0. So for those my patch already does what is needed. > What constitutes an "extra hack"? The one I did to fix the PM_TIED case. I sent a patch for that. > > In my opinion a separate concept of "null" variable will be needed, and should be separate from > > PM_UNSET, since that changes a lot of behavior. > > I don't think it's possible to introduce a separate concept of "null" > inside struct param without touching at least all the same places my > branch already did, and probably others. I would not be unhappy to be > proven incorrect, but PM_UNSET already covers all the corner cases of > what to do when a parameter should be treated as having no value, > because that's how "local" followed by "unset" has always worked. But as you showed the code assumes PM_UNSET variables don't exist. I could comb through to code looking for instances PM_UNSET checks, but I'm sure I will find some instances where the code doesn't do what we want in that case. > > Also, I don't think $empty[(i)] should return nothing, so probably paramsubst() would need to be tuned > > Agree. This may be easier than it seems, because (i)/(I) already work > on scalars: { thing="abcde"; print $thing[(I)] } yields 6. I just ran > out of time to dig further. Yes, me too. My patch did the lazy thing too and just doesn't return anything. > > Addtionally, this patch doesn't change the behavior of the private module. > > If by this you mean my branch changed something about "private" in a > way that doesn't correspond to the rest of the changes, then I've > overlooked something. No. Your patch may be doing the desired behavior. Presumably if "typeset var" doesn't set a value for var, then "private var" shouldn't either. I'm just saying my patch doesn't do that (although it probably should). Cheers. -- Felipe Contreras