From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id C828F28A44 for ; Fri, 16 Feb 2024 21:10:24 +0100 (CET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1708114224; b=XRlrVBfpMu/6tZee20AiB9yd2/akpLAnp5DJb8t+gsDNPfmEpViOa3mKzuCdtdc37wA75mo3oJ 5S3O9rxn8aedYpc+e+s4TnMYNpcGKtEZS+esWtwa/sWKHkFaQAOMVLUeJpsokBaHtvVkgPiWpg HANDwxmcPPxhuwoeivbu23yvhO9v1wsPgoxgzG47R82ipDzUsLwuBQsXbK1xM8D1ptRR+Zz+1V GFAoKYU3TSM5yVZPRO7Zcmj2gFwQp0YxXvdU5oRhxDRZ3imW5KmO3/EzHD43SoCtxvWSE5C8up ucO0Zkm56mceBrIognJK6eTsU9blMI36qQ0cAyyqNKz9bw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-lj1-f175.google.com) smtp.remote-ip=209.85.208.175; dkim=pass header.d=brasslantern-com.20230601.gappssmtp.com header.s=20230601 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-20210803; t=1708114224; bh=FJOSx7wJDGS8ya27R1/WoALN9WdDvayWo/gSgzOHtkw=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:To:Subject:Message-ID:Date:From:MIME-Version: DKIM-Signature:DKIM-Signature; b=sRMH1EEMGBkuLFtaPD+4rUCtCOcXxYLGP/ExxSwoanSle8LxNRlv+jL1W0RqrC4nQLfz+sDoUO a5mw/ppjimsLzcCPvBxpEPjDLPnh2GYTnMrOBTx7MeFHuIwDAW1LO83MAh3SljKUcvRihOszyS VIWUMM4o903vmXPlOoAjDr559UYMWp9toxtI+rXFFib8c2v5uTw1T74bQLZ0PZ3Z2I/I+U/hAO 2TtYdL6J5iZZrQz5xkh00JsBPj1X+zxb6OP+UdkydXjvHBg7qnCXBWQducvNl37xnAVjrixh2c tO7m9750ClGTGWPcO5O1AyCsfziHEQsVL6QHJliLxNygkQ==; 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:To:Subject:Message-ID: Date:From:MIME-Version:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=50FQoiKmlFtoVINX2Wj32WCCDj8quCkENnbRhjJ9Ck4=; b=ZFn5gh2FcCKkRA91FZwmjChm+p qz3rORBGy0HNMcxIKxCoOXbbXO2UJexCLFwtl81BQ44o1Z4Fb47XNpIr/a65JjL/WumKYnOeMFkqy NjIRSz7RMKjNpi7wSc5AanNoHQWwovMtTM/epDrJ97i1NqD+wnSk6CgRj/eVHINSXQOEHSeg3onVS is99UzccB3gLw/M3uTidUEh+rlXyG84KBww8wQ8Msn7to1RehgigjwhcY1Phgi4cTyNgjE3lTy2Q2 Vxq6ZBAjtGTHeXJgAawCKXOBFY8YvlFUwY0+i4uMfctkZuCzxyposDUUvTyyj5v3L88yID3uToDIo fBjMqTZQ==; Received: by zero.zsh.org with local id 1rb4XQ-000PNj-28; Fri, 16 Feb 2024 20:10:24 +0000 Authentication-Results: zsh.org; iprev=pass (mail-lj1-f175.google.com) smtp.remote-ip=209.85.208.175; dkim=pass header.d=brasslantern-com.20230601.gappssmtp.com header.s=20230601 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-lj1-f175.google.com ([209.85.208.175]:55461) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1rb4XA-000P3g-38; Fri, 16 Feb 2024 20:10:09 +0000 Received: by mail-lj1-f175.google.com with SMTP id 38308e7fff4ca-2d21cdbc85bso10201201fa.2 for ; Fri, 16 Feb 2024 12:10:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20230601.gappssmtp.com; s=20230601; t=1708114207; x=1708719007; darn=zsh.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=50FQoiKmlFtoVINX2Wj32WCCDj8quCkENnbRhjJ9Ck4=; b=KQJx5P5b1r/b3nQb9lwKsr/pu9gvKpODgJSPADDi7JlsR6KfbhekkUVVOOtrfxT7o/ 2SOGAt/igrcqXUYV+2QyLyRC5Dj/EG1qJ0drCKa1JUj3syQYn03fgc0+mMhphOILrZOA hI9holklaedENaYPV8TLWzW/NGU+vIO68LRemguvblc+vdep3faTp9xMyU+pmjFGVdyI L4X0vffnNIxNEgqS7qxumgVnFXxuFkqH0hOv8W6HuhOfA/UYeE6GbsNg+GdTX4oW5Vhi 5Lwfg/HOmvz0BCYzDeGVEl6SCzs399pbPqlQpOZQTlEDX0WmRG/MF5E3DEJCvITu9fk0 mrdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708114207; x=1708719007; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=50FQoiKmlFtoVINX2Wj32WCCDj8quCkENnbRhjJ9Ck4=; b=VRttN6Y7HX58agWCSbmpdRyQMEYUoG16xs6wN18mRepmezO81Y9HqV+un/2fXQbtWh ZxeuDWEccTa8s3TUcEvoVRT4d22s8nsvXJKtMLASaZNwrY7AGqczwMDFHH6vBExGUXpb nA5x59cm1Gp3UKjVu6xqx78pJf+NbXyo0tXmbS05pXIxoJX7FFUEBA93dP2WqM96HkiH LZjPdHZg/PHT3KKed5erCRpQi38sgaDZxCoDEAckrFwkuGr1DEmsKsgIggrbg3PlN3sU peGAN8rHVfPyymbJcWSxlZOcysYzJg8XiFeTRGekGYLTnvCJcYl2ZnKfkpQ5DK2Qcixm wnEA== X-Gm-Message-State: AOJu0Yyl3KmkwpxlZ+LZltI4SmRYpN9DNibb9g90cwIW/cYwClhQ8Usp gV0PV//jhpWGEMxr7sxxWQTvHEkdfqKI6QFeWTBWFgVczK7s2qtvElk2IsolhX6Qiii1+GXi1dl tCZq6s8ZQmUlJBBVsoUs0xdDY83i/QdEENF6mHn11aS8j/2w+9g== X-Google-Smtp-Source: AGHT+IEkREDm5AVWp1uwNmdDdAQCH2MbMzpPMrZuVjWhwTK6ADgbc7CPAUMrboBGKOakGIopc9y6qMOoJHvweQrrh2E= X-Received: by 2002:ac2:5457:0:b0:512:8716:7652 with SMTP id d23-20020ac25457000000b0051287167652mr3734343lfn.28.1708114207161; Fri, 16 Feb 2024 12:10:07 -0800 (PST) MIME-Version: 1.0 From: Bart Schaefer Date: Fri, 16 Feb 2024 12:09:56 -0800 Message-ID: Subject: Is this intentional behavior of typeset -g ? To: Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 52551 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: Just noticed that this: typeset -g foo=global local foo=local changes the scope of "foo" from global** to local, but this: local foo=local typeset -g foo=global does NOT assign to "foo" in the global** scope, it just continues to apply to the local. ** "global" meaning any surrounding dynamic scope possibly up to the top level. That is, the -g option starts "searching" at the current scope and stops as soon as it encounters a declaration (even if the name is unset), rather than (as one might think) starting one level above the current. Note prior mention of how ungainly it is to insert new parameters at a surrounding scope, so I'm pretty sure this has always been this way. If this is legitimately the expected behavior (and it seems to be the historic and possibly necessary behavior) there may be an easy workaround for the "typeset -n" issue that was reported in workers/52530 (or maybe this doesn't help at all, I haven't worked through details yet). Tangentially, I think there's a regression with "private": () { zmodload zsh/param/private private foo=local typeset -p foo } That now prints nothing, whereas in e.g. 5.7 it would say typeset foo=local which isn't precisely accurate either.