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 23C462887C for ; Sat, 9 Mar 2024 00:28:32 +0100 (CET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1709940512; b=OrzJCk1GtSy1QKclDLjPcuDRZH+zcXfAJfKPpLqE443lMm3HmA1CjdF9SB1hCdARvGhaBZQRrw /dr5PviqLU47ViIDA1Fgvn2uZIWUjgIsIGxDTczt4nqXQnXaIJrQj4DlZo3MvhnO56Ja3CKt1B 53Q8pCJxTt8QZdpKFyeHw8ibuVyFEJp/Awpq1t4b7l7hhXgdMGnsZL2dgpvEq5Z8peI6l8CRlY Zst++cS23/u7XoanhJkssWUOUpvZuHu0rVZX/HnrrL323akHftYsdY0Vm2stpQZCFFWpxRpAO/ tcp4NEjJK5cRGNzvE45kR8dzVgOOWRrAYRBSiMAfzz8D5Q==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ej1-f44.google.com) smtp.remote-ip=209.85.218.44; 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=1709940512; bh=IHdvOu8M8MjtcN9ZPxu7K2VFci8VhlnDkQOMZmXmEpM=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Cc:To:Subject: Message-ID:Date:From:In-Reply-To:References:MIME-Version:DKIM-Signature: DKIM-Signature; b=gWcEbkgtyQiuFNsWe4HZrJqk2TTxw5+zyOqE1pZY9osUeWcaS40bAR2lLk+8anKvZNs5RNn4bQ c/RO5uah6FaXj5aaMeL5pY35ADMQKIy1RmMsAY/4Xw8oUMlt5ax+QGmpnOTFLKcY/hSTjiY6l6 XT65BB4zvf7pSvPh3fIqbl+WOnNP7aP9bH+F3fC2C/5rtFZS5QXDL/gTS9LFY1uLTGfaujl2MW Qwe0gIRX5MBllJnV3BVFnzX2p1nPNasPJe21kpvpIy3PBECoLkHLNQ6z1jdLFzg7tKTcJY5C/o GBCc0pcxB9ZVpkf4muc9mFEesWzAVCXXA3pdD7H4duk7qA==; 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-Transfer-Encoding: Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=ROkmCvE/j/wJ29Xjyu8czVklZFXGmZryjJRvtuCHdvY=; b=Zl0eJ/a4GgQkIEw1+ozEAKaAjU Q3Byv4tKydfiWnxPODGiKisQRHEHTwDzrFR9Bcto/ZQTl2kV3jkfOS+h6jTzOjukYODL4IWkhxd8y PnSBGOYC2jJk3KEB2a90Sqm1q/0zcyLsrAFFpFM1gqZt7QSCudZN1H32j/Yj/RrUmDW70tJ51hvYy BgOtTSIsLZ4AZDeq2p8xii/x4QGkwB3EZxx8g80Uff/u+klZtth/WFxBlbKj9kjyHWGkcxx6HBTiB 2F73+qU0yVG+iCc0Z5p+/zoQ8PGqnyJCmmyzEVfCSLiXA7nMW5/bccUc0YvMdVKQ8zJMTpzwzV8f2 SDQsD29g==; Received: by zero.zsh.org with local id 1rijdf-000IE5-M9; Fri, 08 Mar 2024 23:28:31 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ej1-f44.google.com) smtp.remote-ip=209.85.218.44; 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-f44.google.com ([209.85.218.44]:52394) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1rijdQ-000Hv6-5r; Fri, 08 Mar 2024 23:28:17 +0000 Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-a460185d1a7so5272266b.0 for ; Fri, 08 Mar 2024 15:28:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20230601.gappssmtp.com; s=20230601; t=1709940495; x=1710545295; darn=zsh.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ROkmCvE/j/wJ29Xjyu8czVklZFXGmZryjJRvtuCHdvY=; b=Ty67yJwA8S29tCcMzy/8y5OCYf36XbGOjkt3oQawK0rbjsW3WnYTrbH9/yt1eK3lOb uGlu29GqGgBUg/GyFTgR+zn487znKS9leeE75S1uYoEVFDWKFQax+KuceDdt3NzBad39 jX3YCQqEJ2bJg4TH6mR6AxMWIlZXHHKn58lhP7pYunXANf/Gb7tRDkVCEpt2PRUMeOV5 FO9XbU2VELHvDNWXIReRo2VXlvU94gWRmgAnWMBPbbwMXHtCDmGHHxuOax51RjXye8Hj 9RI8YyuvARkv9kHy2KtcVYlKBnVDj2TlAdoz0IDKWsFYSR8xngtQ3CdQD9X17hwoGPlT QBgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709940495; x=1710545295; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ROkmCvE/j/wJ29Xjyu8czVklZFXGmZryjJRvtuCHdvY=; b=ncvvS08dixmCToS6xnbNCDiWAE+JkHyI4RoljwTpb/DF4v7ueSsLV34hyJ30li5XCz i7loy9p3QqNxKa4PnA29T6BzxbO4zoaJ58b2TADx1InTbNuMEHUDXiP/k5ejh6Knx5vq EeH2FOdks48rYfWUHjzZuQWLf7FXowehVeewTeUdV7GcJvN78xDKpadO7PAL8x+5//FG 8lXXyNvMCzdvLl0trU4H8pFq4JciXpRXWPiP9bRwVtyZItVMaSW3vUHJB7Pb63YYRn5v Srs0TuS4u629bqQwqFoCwSoEEOrJ5hOzNtxn5YlEhgAF90OBJfvJmTQ/8WlwsJcoCp9G hFsg== X-Gm-Message-State: AOJu0YzEPctP+QxsV41WK1+IRTeRy1p1fF424JhXal1muwJZ4nqVKQUK m9Vm+obbADFIvRY7POjaoinOp58AGp2ZiuUAm0EFq6gc4foIJNzdTNGY5BkO0HAi1Qs8QenH4qW JoDD8ABdoS/W4NaQd6xL5jEg7HbAUY4VQM4x0 X-Google-Smtp-Source: AGHT+IFVdORAlcT6LgDy1RpyS2/fRtzLcTWclpKji8xSSbpD0g+mdasLOZmkBpgw0EIpfS28cYiwvEofoV8xgwOaG84= X-Received: by 2002:a17:906:364c:b0:a3e:9def:5ed5 with SMTP id r12-20020a170906364c00b00a3e9def5ed5mr73088ejb.33.1709940495421; Fri, 08 Mar 2024 15:28:15 -0800 (PST) MIME-Version: 1.0 References: <20240305065606.ccr2ieheahslcpye@chazelas.org> <20240306175711.t3uz2sery3b6tbjw@chazelas.org> <90726-1709936102.086878@xlWC.oGpX.V4Q4> In-Reply-To: <90726-1709936102.086878@xlWC.oGpX.V4Q4> From: Bart Schaefer Date: Fri, 8 Mar 2024 15:28:04 -0800 Message-ID: Subject: Re: [PATCH?] Nofork and removing newlines To: Oliver Kiddle Cc: zsh-workers@zsh.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 52717 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 Fri, Mar 8, 2024 at 2:15=E2=80=AFPM Oliver Kiddle wrote: > > Bart Schaefer wrote: > > Every other character already has another meaning in that position, as > > far as I can tell. > > It could be nice to have ${=3D cmd } as a shorter alternative to > ${=3D${ cmd }} Unfortunately the lexer needs to be able to do this with one-character peek-ahead. So it can't distinguish dollar-brace-equal-space from dollar-brace-equal, and the latter has to be treated as a parameter expansion. > > There is one other possibility: ${||command}, that is, > > ${|var|command} with an empty var name. > > The logic does at least follow from the usage with a variable. One way > to avoid the resemblance to an "or" is if ${| |command} also works. That might be possible. Right now the lexer sees "${|" and branches to scanning something that looks like a function body (closely approximate to how $(command) scans ahead to the closing paren without really "understanding" what it's skipping over). That happens to not care whether the next "|" is in a sensible position, just that it's something that can be skipped while looking for the closing brace. Then at the point of actual substitution, when there's a leading "|" it looks for an identifier followed by another "|". So you can't write ... ${|paste|read} ... and expect $REPLY to be set as the default by read, instead $paste will be set (probably to nothing). Anyway the upshot is it could probably also look for whitespace followed by another "|" without confusing anything. Right now it just attempts to evaluate the equivalent of { |commmand } which is a parse error. > It could perhaps be combined so ${|| Why does it print command not found errors for things like ${|=3D|:}, > ${|*|:} and ${|?|:}, I'd rather have $? than it globbing for a single > character file. See above about the requirement for it to look like ${|ident|...}. Since =3D * and ? are not identifiers, this is like writing { =3D|: } etc. and you get the same errors. All of the non-identifier special parameters are read-only so it doesn't make sense to assign to them, and the |ident| has to be assignable for the expansion to mean anything, so why allow them in that position? Unless you're just going for side-effects, but then why use the |var| form?