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 4192 invoked from network); 3 Jun 2021 06:44:33 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 3 Jun 2021 06:44:33 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1622702673; b=bm172D7aFrH8HSBgxNMXqfM0q1fHUYrfofhX0u/B1oHingIT0BBYDFBcv9PON/O63+pCPXu+8e WsgCp6kI4yWmOGFJrB03clDaHubOrWHNtq3zSNz1dheZOwiCJbHtXUG4cqDwgo6ZotkPNbcGff HdyR82PGFy6v39ZJK90biVQ4uj2957xqzNwFGfL2UUx/+8usvSG1M+elosFXv0uGTPvNIKN8ig 8Z+ytbgqnPbnJzGJuzizb+zKPVZtGZk4jxC8+MheGaj7s54dhqBc6lJDnX6piRYwQJSp+bXlWh w2Vr8mHrk0Ta6DFG//2txDmKWwJCefsKKm/1W3imkoEaAQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-oo1-f53.google.com) smtp.remote-ip=209.85.161.53; 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=1622702673; bh=0ziViSxLzbYBqu/3EPZhqk13+WwnOPy/rIBltVs+mtE=; 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=Uu/SxSBj9qZQi8A6cGaCCdK+klLcCX81wpu6Uj/6uRAlcVVXvRBLYzI8yzrOtECZ/e/2tDFNDZ t0rjEtLGwWxiNFzuHc0zExjtmEdkZPZeyXmQqOQg567Uc6QYhCBT8A1UaR+GQNTH+vYmP/9W49 HVe0z5xLMxDOk5QfBd5WX0CtgIalln9nFg2sd92YfDoHZPIaX60gdv9fTG2c9sJF8lXuTKduqa u7ZszkbWOGELm9Fs2cDWwYwEYzlGuRvFLHWmWp3fPYsGY9mSGC5pNnq2E+PD6Bo7yWaoKSADX7 VRvtGI0XqlXCQ8M/H6610wIdSR2IaYVoSy0eED+Fei+57w==; 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=S+1qjG2KJ3CUAsEKiFtL28PgzFhUXjTD/YJ5Rf1RvNo=; b=jqZAtli34qdEncU6txHU2oxW66 2vIxAKcJrQtW9uo2RZIMp3OzhUQoNXTKEs4y0DZQQitAayOPK14HT7FOVk63M+Fsia6nNOg1910ok u5PlSQjqRn/UrVyj6wW8vpKDx+JzknXugihx8rz843p35OZFWkRL95r2fgzDVQvrVm3nYAP5PAEpG e3VNiaSjtBr3JWVkAIBe+NkKPl/+20qC302oyMDI9HG5z+3VO2EQjhAjDkBiZrzToACjMhdJDKbVP Kro+ROa3F2xvgCUWQBpLCwNMfoiNweje9Fo/cTUvB4uMngFSg6Zs/TzycHEKdyQQPGGG1+FNcdOmW LQQVNE1Q==; Received: from authenticated user by zero.zsh.org with local id 1loh5k-000FhM-VC; Thu, 03 Jun 2021 06:44:32 +0000 Authentication-Results: zsh.org; iprev=pass (mail-oo1-f53.google.com) smtp.remote-ip=209.85.161.53; 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-oo1-f53.google.com ([209.85.161.53]:39683) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1loh5H-000FPW-0F; Thu, 03 Jun 2021 06:44:03 +0000 Received: by mail-oo1-f53.google.com with SMTP id 67-20020a4a01460000b0290245b81f6261so1161618oor.6 for ; Wed, 02 Jun 2021 23:44:02 -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=S+1qjG2KJ3CUAsEKiFtL28PgzFhUXjTD/YJ5Rf1RvNo=; b=0c/BGMu+pWUi0vWIQBH92FvPW/bz5n4jvxh/qDobfglxMNxzYuCbGKGvIr5LueNduq ECG4XhCdaET5G+cWPGAtmbkF1vsdyPBUSkbFjO6lPYKJ4gAyW+OCFOJPttjrxUI+uVgW MnvrcTrFXN9ireWGRK4zi6Tj3NGuA0TgsF/CNj4zKk3VsUIn00/gI8pDg98hO9WhIl+4 O/eZ+iYPF0s2i28u+joS6+MNjlARDBID/zSzdL02tkD6mEXoojIp8F8SMMW8g5DEwnud tWc3BibuIlt2AbPQEvZlF5CL/Yj4lKr2pNO1BoaRi8HPuSZefdD2YcMVD6lU0X78YVvN rz6Q== 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=S+1qjG2KJ3CUAsEKiFtL28PgzFhUXjTD/YJ5Rf1RvNo=; b=Aikcgr/rPi1R9d8RzBS399utTErhv9bjqsEGBX+sE2IVg+FzN2q0Dj/7LSsfLGjzPT K4aXCJgGISsv6C9xP7tR+aBM9exaMYWRNE6GPwBlgEJjuTw6wWVcY/qdCJHQf/MbZrwe dR8jWim9F3V/L1ADLW6RA7VDYHDe7UCDXfZKpfr1NCu2vcSgv76G0TG0QzG/KkuNdM5Z Mz+sC5Akm/BTG3NBUScyqV1ATovIaDhpbX7Ra591bpW8G5qvxtszRNyCVfs0z7Uec/U1 lBMZtHjW3QiI6BJRCunaNFn8TWWSRnSxVSOiCL6m3hNWXCx2DCZyIcES9o9BVEwHaHWA wiIA== X-Gm-Message-State: AOAM533M42oHbvgn9l8ok3Ckq10gKr2RVESx2NjTR0Z4MuIjU/fZ2jIM xXPv6BwDjHEbL/SUsskC7965GsNxXcLXzWHVl8xQKpOZWAmPtA== X-Google-Smtp-Source: ABdhPJzX2niWxgQ8JbucbYtrH8Lc7z9pnA3dk8Ocl6HSkHp1IcqAH4lktqjWQuoQFGA9mXIPyXgZIwgl2nmbbv60MIw= X-Received: by 2002:a4a:b98e:: with SMTP id e14mr27570185oop.82.1622702641535; Wed, 02 Jun 2021 23:44:01 -0700 (PDT) MIME-Version: 1.0 References: <20210505114521.bemoiekpophssbug@chazelas.org> <20210601053235.b4junj6muuwegl7b@chazelas.org> <20210602091145.xvyymjxdors6kqya@chazelas.org> <20210602142005.b5tw2hj2c6q3psqv@chazelas.org> <20210603060546.lvai62egrinwrbni@chazelas.org> In-Reply-To: <20210603060546.lvai62egrinwrbni@chazelas.org> From: Bart Schaefer Date: Wed, 2 Jun 2021 23:43:50 -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: 48999 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 Wed, Jun 2, 2021 at 11:05 PM Stephane Chazelas wrote: > > 2021-06-02 19:04:01 -0700, Bart Schaefer: > > On Wed, Jun 2, 2021 at 8:59 AM Bart Schaefer wrote: > > What I realized is that for any unset of an array element, the closing > > bracket must always be the last character of the argument. > > D'oh, I had assumed that had been like that in the beginning No ... it used to do skipparens() which would always stop too soon if there was an embedded ']', and I changed it to parse_subscript() to make '\]' possible. > I think I'd be in favour of breaking these workarounds on the > ground that it would fix far more existing script (that just do > unset "hash[$key]") than it would [break]. See my follow-up message comparing variations. > There's also the question of what to do with ... a bunch of things that aren't documented to work with associative array elements but accidentally do ... > My suggestion of making unset a keyword so that unset hash[$key] > works as expected while unset "hash[$key]" works as before > won't fly as we can't possibly make all builtins that take > lvalues keywords. Strictly speaking they don't take lvalues, they take shell parameter names and use them as lvalues. > We can't really expect people to carry on doing: > > () { set -o localoptions +o multibyte -o extendedglob > unset "hash[${key//(#m)[][\\()\`]/\\$MATCH}]"; } There's already an unreleased change for the (*) parameter flag to locally enable extendedglob: unset "hash[${(*)key//(#m)[][\\()\`]/\\$MATCH}]"; } but still unreasonable.