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.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 17300 invoked from network); 5 Jun 2021 00:21:16 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 5 Jun 2021 00:21:16 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1622852476; b=pvM9IXjrxKQR+7zYzj0ZL88VbgSwlHLXtcuIz2CxZizqzA7yAUl3iwbzyh5lBL2xqoAyy7rSlH 50eEmYNuzHPl9p/W/HF2NdgH/GgfW0SiMYE0XViSsN1OLpVU17212kQdMypazRXlmq/I7jOlbk gnljSp8sX6inB8hVHMLjidcALtVew6F/5/wLj991ubYW2v1aYl+9Z8YwjdP8+e5EL8B4Myp4/d aDxNNF8kalz6WifRPECmDhxVmfQQvHKtl8Y1nvEvRrBUJMKOMleDWF1lPWWP5i3/G8jJK9RKpD leA4Cvp5ReTUb3klbtqJ54u2TzKPPhS80N3CBvaHt74n/A==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-oi1-f169.google.com) smtp.remote-ip=209.85.167.169; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 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-20200801; t=1622852476; bh=mCcAN8FKEmwx6dkcNg8fuDF3xTbsJ56PTYeTsIK8O64=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=yPsu5QvwqybXoYhEDRQGbbvU+yh7cfp6AKbWOx0a8R9sPTnMuoG6kTr4OAcZQcko/9B6yLygaH OBxBxVcgiJKLuYqaSL0nhGmXCIVbAY2Ce3STegDvQrkNlEpvPGduLaz3ESuwcIxf3gqMpSEu6A luu4/FhRqTJdKzCok7QmePlZQSvb1RvETrY41WWaOmVDr9Xmz9VGU5EjK8PN8Vkfm+jVX/tI/d /7QRlDY7RSWHTdwOqbH+XhDDxf+DkXuIQ4Ez/CmFj3Z8nVrrhj0hxN1AAcj2+2pIImjZvYO+fY m+dbgf65JK6F9mY8Wo+OgtBEFJ8c7Bv1upt0PFSjJCe6uA==; 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:To:Subject:Message-ID: Date:From:In-Reply-To:References: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; bh=VGLFvAfZpKB/njWHwehozbjC6i9NUKGFmX6/SxiIW0Q=; b=KDql7vr0Y5AZwovpMH3YYbub0c 1lWg/99FBnIGgWDDdPkyr81GPVHO4R2HD9wLeg51VIW0HnYUZN9/O6yANwCKxdG5LcixG722byIEX MEW55fFtg8bkmM1Tl10DaNA1iydizKStFsVfJbPaYvzasa5mDHw0fwjLlsbDnlwLrV/ZPV+3Wkh62 c9OylY6s/D3Nj36VLdggEblYcGVnhTJnbWHGb7ApKDCeyliF914R0oO/L7yjM5wYii9i1Am6r/fga 2HbKXEZ3tt/mdJquRIUjobDCKBgYuFcsmbdTzWk8XxdmydZKYmK5IVwA+UsBKAGCMYK9cR/kRNJtJ m7ljTqcA==; Received: from authenticated user by zero.zsh.org with local id 1lpK3v-000OuS-R7; Sat, 05 Jun 2021 00:21:15 +0000 Authentication-Results: zsh.org; iprev=pass (mail-oi1-f169.google.com) smtp.remote-ip=209.85.167.169; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-oi1-f169.google.com ([209.85.167.169]:45883) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1lpK3N-000OaL-Vn; Sat, 05 Jun 2021 00:20:43 +0000 Received: by mail-oi1-f169.google.com with SMTP id w127so11442583oig.12 for ; Fri, 04 Jun 2021 17:20:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=VGLFvAfZpKB/njWHwehozbjC6i9NUKGFmX6/SxiIW0Q=; b=Hk00h37EntrRxZALMko4ojE/mgigC3jmKDuv34CDpIAL1RcbdsbzCuFmdB3R5/y14i YmvZT4Kj6zG7+ZwqyOxaHEi8hyr+nrQnsXAbcaGsmnAy2RxmLS7YQTBlUSZBjzAm3LCp E/p5PplIhsMi9pIVNd9w0+cTNqDyU70Gv1U0+r9rhnvJxxdrLVcCTqPq4d5iolgGOeiN heIAtTd8KPcDDoJMyoMvPfDx/4i61z9eWks9Yh7u2iz2eKLkCKlPTvS5VEqNwo3lw7W2 baUhMubV0F+5t/9rubXT6s5Cim4c7Pd10iZRu2ZtYjg1LwVQ8eZdoBGVfSeVDZikNfto ZEFg== 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; bh=VGLFvAfZpKB/njWHwehozbjC6i9NUKGFmX6/SxiIW0Q=; b=ZDt14scxdt3VsrdLZRmpAoHyudlJSwTtQcFSWd688l6QrCv8kKzbTFOdlz6ilHQpYO 3TnJ7czqu25Yzf7K+kPd1JINqNNwnt2uIuQxa1i6P8bsZ20+yhyfCTfdaZvrcXVtsTzl L80IjyXr43NxgXQjqIGCcUDaInGefjwToyiytHdXvJKCfs2gHtZkAms65bSKPOEJjRo4 KT/h2k6w6nB90bX3TzUFGr6O52DcJ2TCeYcY/Nok/PLlMKUktS4RbLy81sgq9mEcMeSK VUfVG3nIkR2LlfCJtnYT/TXxao18HMiCYhtpXUUKlk6yX/+eh9EUkMGBjsjTxa0Q7nHf GP2Q== X-Gm-Message-State: AOAM532oP1uhMQEH/lHrM15mGg+EGXm4Jg//qUsE5LFd7K0JdbDOQtNG gfowzUxV+j0UcxA+8CI4L+j80fdMdfkmS8Hxyl51HnEk7a+4Hg== X-Google-Smtp-Source: ABdhPJziRuLF8+SHntNLuMCrm2COXXbRPMYAwVbIiF/4Mq9pzsbhs0aKGCY4CW518hXGrsNrI/GG8QAG5ReADjx7axI= X-Received: by 2002:aca:f452:: with SMTP id s79mr3202056oih.84.1622852440176; Fri, 04 Jun 2021 17:20:40 -0700 (PDT) MIME-Version: 1.0 References: <20210602142005.b5tw2hj2c6q3psqv@chazelas.org> <1629605749.599911.1622710481163@mail2.virginmedia.com> <20210603131347.i7bv7ao7j3hk3a2e@chazelas.org> <20210604080200.pnlzjexcuu3oyjcy@chazelas.org> <20210604202116.gnxqqegfnmki2i57@chazelas.org> In-Reply-To: <20210604202116.gnxqqegfnmki2i57@chazelas.org> From: Bart Schaefer Date: Fri, 4 Jun 2021 17:20:29 -0700 Message-ID: Subject: Re: [PATCH (not final)] (take three?) unset "array[$anything]" To: Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 49019 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, Jun 4, 2021 at 1:21 PM Stephane Chazelas wrote: > > while IFS=, read -r a b c; do > unset "hash[$b]" > done < data > > And with the stripquotes patch, you'd have the *contents* of $b > (from external data), not the literal $b string fed to the lexer > as if it was meant to be zsh code. It's doing only pure lexical analysis of a single "string" token, there's no chance of it interpolating anything. > There's also the fact that we can't do: > > hash['foo bar > baz'$'\n'...]=value Hmm, you mean because subscripts (even hash subscripts) are parsed as if in $(( )) and $'...' does not expand there. > array[1 + 1]=4 > > That is pretty annoying. That's just shell whitespace rules, though. If you have nobadpattern set, you get zsh: command not found: array[1 And if the parser doesn't eventually find ]= then what? Re-parse the whole thing to word-split it? I don't think there's any way to retconn word-splitting. We could perhaps overload ={...} (or something) so that instead of : ${array[1 + 1]:=4} you could write ={array[1 + 1]}=4 but I don't think that's really that much prettier (and unlikely as it would be to appear in any existing script, that's obviously not backwards-compatible).