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 autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 8056 invoked from network); 28 Feb 2023 10:34:27 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 28 Feb 2023 10:34:27 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1677580467; b=OO3RzrHuPNiPgRnls4sV7hSPHhJ3iJmdavuVbbBhL1Q+RH7TMrEnu+fg6pcC4hNknhrWnywGuJ qvO0Wk7KL5vkX8L1WIlvAGhrdg3hzkql+JAqva2KetroafZ+n5Efg+loA0+TDwldyOTUd1tl2M htI1S19Kvr1UAEEpWjZeDy4B3kcbn5p0HQ8gOypSd9CO7j8Km0Nt5cRwHV4X3ot3+gsHK6aG4r eoME/ISktDwRPsCXGPe4Zt1r8JYSNX7D3xnnrr3FyTIgDa669XxVCNbCdO56WFa7RP2dUkmJ1T DITquonsVu41K6iQklqhggzaZRn58N5x8Gw1by0pWUGYSg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ed1-f50.google.com) smtp.remote-ip=209.85.208.50; dkim=pass header.d=gmail.com header.s=20210112 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-20210803; t=1677580467; bh=8nYi1DFEK2kchjNV4McQj/ZaYf5DT6l/cS0yL8NmmLY=; 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:References: In-Reply-To:MIME-Version:DKIM-Signature:DKIM-Signature; b=kbFVtzQhzyVBBLVV5VNFUhAY/IGuY25AYFD9Znm15zlx0ks3jjYofoEDMBsSLRXIQ93EWiq1uc pdPCdEJncu3wlO6baR6bHVpFsWqDzEflO2rs86fPa732fAbX2SxnHOJ/DWANg+rh4Zt9WbKDf6 KHMvNoa3+xSDVvUZfIHocFkaZ3Bzj3vs+DLK9CvsHlA+XSuOX36IWJRtgjmicueomsbH6C2/09 KLOtEMfV+5TpB3Rsl7fXcPVRuImVFLy2CZcK4uSA/8jMKT+Ttlw2Bn6f8P9F4PSQu8YXESownW ghXtSGlvYPTJKWSbSD9xJVaTf+dMk6x3e58arc5/f3B4Mw==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; 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:References:In-Reply-To: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=Q9n5EKia7O45LfWDGVX/nMvHnrzZScqx1gbKZkT3FT4=; b=ePTrBOWFD84IomgknQgehbdc5W 372gNKoMIrkKetW1ywuZELS8jaubv0BXPlcffooDJ6E51uWAIWj81US1yuGC/p6VYfkarR8j+DD+u 5Kwyhs43qtJmM9Jh1l8ik3Ni6pZxKIwDUnUgH/5dC+eAbKOUhp6CBHtXekBR1PKPxfzXmVQtQtiHQ ilwiuRLavKqki+/p3Wnmy2KU0hfKnFRkvItmMunk18d6eUSySkNX4QYPC81qnhowD7ExcVhcDOKd/ jhQtG4QaiAuSv8nQf04jr1Kzud4Hyos9X9ZVIeFkBHTqYwjcHzEE6EbJC6pVG86n+h2jUylOXXFAe TFm7Jzbg==; Received: by zero.zsh.org with local id 1pWxJR-0006Y8-Tb; Tue, 28 Feb 2023 10:34:25 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ed1-f50.google.com) smtp.remote-ip=209.85.208.50; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-ed1-f50.google.com ([209.85.208.50]:43879) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1pWxIt-0006Gs-5e; Tue, 28 Feb 2023 10:33:52 +0000 Received: by mail-ed1-f50.google.com with SMTP id h16so37803489edz.10; Tue, 28 Feb 2023 02:33:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Q9n5EKia7O45LfWDGVX/nMvHnrzZScqx1gbKZkT3FT4=; b=H6RuB+RquVMteFtx+Ex17SO322IcUDJ+zUHh4DTGxg/aIuGWhABcfvdhbuSZtPc0ym ZvwRxcyEkwDOFUilS1/nvCdVKLdDtUhpw1kq7i60aBcVu70SQb5VOUr7ZFo99wggLRQy mufxydrqryAPNG+DPDpist65wqlyT1iC4vMzAxxDoqj2opZstGhIG4Tkmx9vTfpn/Y6Z IKLsMymuwQdsGIme3arfBLbUWQnP8DanUwNZWHJg7bysPMPSHk9gDtTBvE1yWZ5Sh2sr J+Cp0Sb1lpOscGXetrRKHq0R8M3x+QELNjJxhpCXTXlIfBIGLBBbkNH414/MxZpq1BEB yvMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Q9n5EKia7O45LfWDGVX/nMvHnrzZScqx1gbKZkT3FT4=; b=nHkfZHbGIN7L4lwqtukEG1UcMzoitZhKXTcIug57l7f+FoVhD/N59lYQy4O8vtJp2w cvT3E7z7IYeYCHWmCJSCKMy96xYzasQ5v/Y5EYRJ7x056myJzyscM0UrM9Fdt+oKAZgj wt+pmMDFHaWfIwnVOU2FIS4BfIt4zphnJvmd0xsRKMRjae6Yt5XnDoUZeRbCYE8Ta+Fk 7O4TdVo7uMrZ3vZ65uM/a8IPJh1UsLeVTLBzgXN4u7YmCQZ6kmWmwKghEAbZMCfZbzhX tzy5RwSn3f3oPchOSqhQnY9O/XLpgNqpaBM1UDZRSK6/lkPpnPUzSYlQqC23rkGAGVxB CswA== X-Gm-Message-State: AO0yUKUlWAuG8RiU5Ucxhwnq6iHO+tRRrJaQBLh9MS44622Koiyk/qQH C+jFLhX5dO9/Nd2c+yEvc67YzOn0Ccx57aQDTarGt+oR X-Google-Smtp-Source: AK7set9pWM/W8HTBjfpKfHKldcMSEj3N/jyvj2qvTWfMA6VbmXa8w/lhIohutHwOqns5QEOA6B0W0bvUpZegjoCSVFs= X-Received: by 2002:a17:906:1582:b0:8b1:7de9:b39b with SMTP id k2-20020a170906158200b008b17de9b39bmr1049125ejd.1.1677580429756; Tue, 28 Feb 2023 02:33:49 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a17:907:6d9e:b0:8fc:2473:c0d5 with HTTP; Tue, 28 Feb 2023 02:33:49 -0800 (PST) In-Reply-To: <60026-1677574037.450652@BS_8.Gg9A.ql-t> References: <60026-1677574037.450652@BS_8.Gg9A.ql-t> From: Mikael Magnusson Date: Tue, 28 Feb 2023 11:33:49 +0100 Message-ID: Subject: Re: expanding nameref target? To: Oliver Kiddle Cc: Bart Schaefer , zsh workers Content-Type: text/plain; charset="UTF-8" X-Seq: 51489 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: On 2/28/23, Oliver Kiddle wrote: > Bart Schaefer wrote: >> In ksh emulation (and history disabled), I have this working: >> >> % typeset -n foo=bar >> % echo ${!foo} >> bar > > Supporting ${!foo} is useful for ksh (and bash) compatibility so that > sounds good. There are also other forms such as ${!name[@]}. > >> However, that's pretty clumsy because of history expansion, so I'm >> proposing the following for zsh native mode: >> >> % typeset -n foo=bar >> % echo ${(?)foo} > > I would question whether it's really sufficiently useful to warrant > that. What about (PP)? There is some precedent for doubling a flag to disable its effect. The downside is that (PP) already works and is treated like (P) but... > I'm inclined to suspect that anyone who thinks they need ${!foo} > has probably missed the point of namerefs. Unless they are writing > something that is meta in nature to begin with like the describe-params > function that recently circulated on the -users list. ${!foo} may give > you the name of a variable that is hidden by a local variable so you > don't want to rely on it if you want your code to be robust. > > So my view is that I wouldn't bother expending one of the few remaining > flag characters on it. > >> As an extension (more by accident than by design but possibly useful): >> >> % echo ${(?)options} >> zsh/parameter > > Doesn't that lead to a conflict for a nameref defined in a module - do > you get the module name or the target of the nameref? Does a nameref defined in a module before the module is loaded actually have a target yet? -- Mikael Magnusson