From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 35c42333 for ; Sun, 10 Nov 2019 23:40:17 +0000 (UTC) Received: (qmail 24392 invoked by alias); 9 Nov 2019 08:53:13 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 24416 Received: (qmail 13145 invoked by uid 1010); 9 Nov 2019 08:53:13 -0000 X-Qmail-Scanner-Diagnostics: from mail-il1-f179.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.0/25622. spamassassin: 3.4.2. Clear:RC:0(209.85.166.179):SA:0(-2.0/5.0):. Processed in 2.372464 secs); 09 Nov 2019 08:53:13 -0000 X-Envelope-From: roman.perepelitsa@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.166.179 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=QvlbdKviald3V3pA6VhunH7P+MGZrspZQjOcpXFp6Ig=; b=YQDkBYn76AsHuiU+/cdNIcOfvMCsPBj/0zqEwj3EgoSGQgwolR0MxqH5TsHHFW4d1g kzTzGGgPV8yXaC4luyt4RawKIeayLa20cXZ2imkxzsSqmpUIsOgUpPmus2Bz0jXFMHmZ B2wAgkR6T3vq7BnI8UJKkKpMPTEv3PyjFqdd29Zk5hNBvjlYQuT2B/bJpcvQ3tHTlLy8 Cx3L92vqOB7siP7ldgzBeJ5s4ykFr4QmHZrzg9k7h8U/RmBBrXpr94Msj/BjmAPHCZTn Y5TkyDjkJ7PFsnZf2VGb2RWsAjZI72Du8g9TtuSoQ9wHKh4o/Dykg/QWQ1loZXzoe4WB aOXg== 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:cc:content-transfer-encoding; bh=QvlbdKviald3V3pA6VhunH7P+MGZrspZQjOcpXFp6Ig=; b=pxZ7QJW973OPus6iDBaGMNGNRPPvykylqeo+N0LyDfQZldCow8NNEzsxcpbpvwo4uy bEySVqjtYQzQf8oRiR0CJJJFZlJ4WgYfKg7tZtkBhM2KLenYt1MansoMt2D4A1bFInXv 8uItsxIVGuMDmdPFILt7RJDVrA3olHUaclnBdXfok7LXRzEXRKIywIAtso1uSaYvV+d0 J3MKaTWvxJfnKnA+t1yaNgzELd+ac7NJEeSmRyZcuXZgbgJ27Mlu+AKJ7OEV54iM9lYm 1sgDMb7DOS+LYlkNjH9ZUuy6fcOBGfhG5oPzlrO67ErrLvynTvu1eUj1ym1qEgCLqYGj Lz3Q== X-Gm-Message-State: APjAAAWn2U7lTS+sQ4Fd4zeffbI8VDjDjzTLLs4+lW1uvBylZGFk0qwN 93SvFkr8G+c2rqclPbYpQET+ObJcM0cwuzfFxHY= X-Google-Smtp-Source: APXvYqwUoRgkHNJNgPeGNowVOW4yqTeh9oeGx6hba9iKs1BBrj8UMQ6ZA4LU2xsEunCU73QV6/GfKVo7eTa0i5tv+4U= X-Received: by 2002:a92:7e0d:: with SMTP id z13mr19215204ilc.168.1573289558561; Sat, 09 Nov 2019 00:52:38 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Roman Perepelitsa Date: Sat, 9 Nov 2019 09:52:27 +0100 Message-ID: Subject: Re: What's the reasoning behind z & s returning nular for empty input? To: Sebastian Gniazdowski Cc: Zsh Users Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Nov 9, 2019 at 9:40 AM Sebastian Gniazdowski wrote: > > On Sat, 9 Nov 2019 at 09:22, Roman Perepelitsa > wrote: > > > > On Sat, Nov 9, 2019 at 9:11 AM Sebastian Gniazdowski > > wrote: > > > Thanks for the analysis. The additional problem is that quoted but > > > @-lacking s-flag should still elide the empty elements, as the manual > > > states. So this is an intentional exception and I wonder why it has > > > been added? > > > > Here's the passage from zshexpn: > > Yes, I was also referring to this fragment, however it states that the > empty elements should be removed, and even =E2=80=93 that they should be > removed more eagerly, so I still wonder why produce a nular for an > empty input? Oh, I see what you mean. Apparently, only inner empty elements are dropped by "${(s...)...}" while the first and the last are retained. "${(s:,:):-a,,b}" =3D> (a b) "${(s:,:):-,,}" =3D> ('' '') Looks like it's either a bug in the code or in the documentation. Roman.