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.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED 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 24A542159A for ; Wed, 27 Mar 2024 19:58:05 +0100 (CET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1711565885; b=KhcLJ9gNTbELSeoL8FkivwNJNumQ3pBOKyjbw//KUqoUYDHIqs0RNYD8y0lAjhErAFvHMA5cwk +8B03GEWR61Il/4YjJx4wdx3UOxi/bmQeh0IRIGd2ZAagANOFy0vTwCJpkLLadmwCbI7RVebS0 kqP+m/xch+BLfGvuGAgtwVHUpXt2kZPQcN55Myx1YJKFBcOPwYNVa9pagjDas/UgQY03wnuT8/ 0W6rxZi8RE7Cb7/r4HmCF/5vRxgcMYshKJEGDCEncGD0VNX8faWZtAZdrfy0xuOBBI5q7Y4G2Q fvAHF+xr9w0OymUKUDAgjbHFEAnxP1k5b08NCsdKdMaWWA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ej1-f42.google.com) smtp.remote-ip=209.85.218.42; 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=1711565885; bh=GnpG2MhksArpGo3I+IitJBpGsB2+tj9NDnWIvYN7cwg=; 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=jMZKfr4nIEle3VKGws4XmQDqqbQIfIyN2yCQHxcyaHsixjetxa9s1FB4Yfzz8ITe1dzso+T3yP odh7uL4WJ7N/V5qmxlf16A+DDSmxqd7wbEfEKI8wNTZboIi8OtnXZrsnZSU+h2JvrXMg63cOl5 2ZdVOJb3bTXWi6iz9NGb7tpcAX3nVuU8lF/Z1FDxC2o6TroCImyWCCQP6gE3qxOKfb5p4naq5k hqLydJN+9p4NCj6RV3ESgBESCpKcCHlKx504B5Rm9BMPgcVoEoVGMRq2rGxziqR0huElrUihOi +eUsBvBel+bF02Dv+U2D6BAjpnMtb8uhOwE3o1/7QVXMxA==; 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=8mbriBt4aoTjXJHXZMMJvW7NZFo2T1BOhAxBMSyzYyI=; b=o/QT0AJYECpJcCI6zbimEMjl33 Q1E86VMsqsWiVccPFYi0NWtwEg7aBbbUmeoHgyEm/PeROILwVc8cYZpjF5gaoUL9sQAzvuOtZloJ2 IjcqDOfGN7TpZRhL7SBt5TaDoY9YAybR5SwB1CTS2ReBtz6C3y7BKMv78X3ZXowEI3z2+h3YR81zc khk/EjZQ0pBB/4V+eWt7czAPX5xwRlxzutISQBWRJ7M1PFipXRQJFFBMV67i+L4akrJ0SMqDfbZKT pKTSiTm7kMncLBeG2bwyAv68ZdClAXenagNObx38HjFkf2B3/ACrPLH/6A+H39QFUo2GpKo2aoiiD Gu0vJR2A==; Received: by zero.zsh.org with local id 1rpYTM-000A08-37; Wed, 27 Mar 2024 18:58:04 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ej1-f42.google.com) smtp.remote-ip=209.85.218.42; 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-ej1-f42.google.com ([209.85.218.42]:60655) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1rpYSl-0009fu-SP; Wed, 27 Mar 2024 18:57:28 +0000 Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-a2f22bfb4e6so22206066b.0 for ; Wed, 27 Mar 2024 11:57:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20230601.gappssmtp.com; s=20230601; t=1711565847; x=1712170647; darn=zsh.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=8mbriBt4aoTjXJHXZMMJvW7NZFo2T1BOhAxBMSyzYyI=; b=2n0gtzo/CytXmMSNJemfJsKzS8CGxake1/wplrfjJbKdkwB893+B6QeeuRLkQ9eXPZ wSrLqw+cIGrdn2rYM8Z+99ubyh5ORskJDfuc5g4weuVqPeKRA7VUDIR5Ag21GYRY1EGN shUkLv5yDv3/N7chh684gsYu0ckNPA1AfIOXD6zDUW7/cyoI5pyJsDk2ZWIZQxACWhko BH1bR/s98s+pop0doubnsFX4x889yvQlYkb0K8YEMz80rwMDV8MdFP0QRZzmR5iBHOxv G6xXdlOZzaph0sNRBf2KCA4fhv55HEcg00p48X3GPreCxGsp2N/S+Nvn9xNymPP811ID 2sJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711565847; x=1712170647; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=8mbriBt4aoTjXJHXZMMJvW7NZFo2T1BOhAxBMSyzYyI=; b=QFIGsFSoTefKYU9YAiGgWjjfSRv1Q7xw/1nsmLNmW8h+FYSO9Vk57Jl3Db4Li0EucS DgB9eUzmgkAFA0AWC+WBpNLSlEytch4iOJsY1CusjOZYqTxCecfwijW79gj8bBp3dDSF upo4ge9au8CdolSNDW8r3AVQDqipcb1hLpbb6pgyCV6xRSEm9XAcRWwji6yXTi0d5FcI BFgtgyyXsbHxGIjLW1ux/hW815tBDieUzfCJR5AQkqtLRatqiosmOvQa42V5uVJGE3Jp flvpTFCEfnMbREFMW9DE40yOfbm0dUw/QVr21OhGNrJp04RD5JRtfThkJ2OMGX9ykD/I YnWw== X-Gm-Message-State: AOJu0YzrpCpa3zWXQQb3TOrFg8mg6tsHMxR5VirwejlhE3XjIcUDUMng 3dXXqEvrE6hc+60ou113y+JLdGydk15YHhWrXDw70lU9kx2ZalGiEvJYCnzmowM9m0MQdM+4gW2 qqzMXaILKe7TPInoEgYlBJGF1HdxxJ3YmtHteyKkJYh+CXyPouA5G X-Google-Smtp-Source: AGHT+IGJvwvYur3NS5Z1KbvXH9tKAMt+Xex9KsEwm+UE9NEtsRbCfHywPmDCSkB9hhclcwKul9akEQG3/LEI+s+wQPM= X-Received: by 2002:a17:907:6d12:b0:a46:5e1b:58a3 with SMTP id sa18-20020a1709076d1200b00a465e1b58a3mr341566ejc.35.1711565847111; Wed, 27 Mar 2024 11:57:27 -0700 (PDT) MIME-Version: 1.0 From: Bart Schaefer Date: Wed, 27 Mar 2024 11:57:15 -0700 Message-ID: Subject: Nofork ${{var}...} edge cases To: Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 52832 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 seeking opinions: Should ${{} true} (empty variable name) result in "bad substitution"? Otherwise it's all side-effects, because nothing will be substituted. The prior ${|| true} form was a parse error. Should ${{var}} be a "bad substitution", or print a warning about an empty command? Otherwise it just substitutes $var. What about ${{var};} or ${{var}{}} etc.? Given: % REPLY=123 Currently this works: % print ${{REPLY} REPLY=abc} abc % But the following does not substitute "b": % print ${{REPLY[2]} REPLY=abc} 2 % That's because REPLY is implicitly local to the substitution but REPLY[2] becomes linked to the caller's $REPLY. (This is a problem with |REPLY[2]| as well, not new with the braces.) With any other name than REPLY, the subscript works as expected. How much effort is it worth putting into fixing this? I would expect it more typical to do: % print ${${| REPLY=abc}[2]} b % Or we could declare ${{REPLY}...} as NOT synonymous with ${|...} and localize REPLY only in the latter of those. That might actually make more sense. In an earlier thread, Oliver asked: > Given that the ${|var| ... } form appears to create a function-like > scope, should var perhaps be auto-declared local for that scope and the > local value be substituted? Among the reasons I listed for not doing this, I forgot to mention that subscripts are allowed and you can't localize a subscripted parameter. I'd like to resolve these before I update the Doc.