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.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 30998 invoked from network); 25 Oct 2021 20:03:38 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 25 Oct 2021 20:03:38 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1635192218; b=b4O4k+maMdZaebHQ3gM2Rh0CA6V9E+vlin4Qn3E394eBhPMW/oar2CGHFEe4rstHe7GQlzcToG 6/n4mTDeOAJ7ogrCj1wmSBenfbeNyIArAcqdKzxdv2JudBUuMxw6cC42aLpd+D4Yf9oQ9CvH5W raYiZstjlQyugvRbp63Dbsy6BEa8cV1pxFuniZVJ+S0pYHNACU12aZmU6KutXCa+NkLYiHGULE oP1f4MiI3rNBV/VekAJelkV3Q6y84R3WpfUS81/+pvbGc+YSBhYX+lMszLwo2G71+83ZPO+8DE 36r7o37Kp9JSNU57RcXFaqRefrpUYV1yM/TZmOPd45yDrg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-qk1-f169.google.com) smtp.remote-ip=209.85.222.169; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1635192218; bh=Qw2P072eazhBmfSG0DtbdnJYmB0FKVbpDiNY3Lh3R1c=; 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=QZUIijq0AAPo2Wf1R5+r8LArucJXYUN17p32/ALo/NGBikEIy1bYOmR1yhoW9r9MuysSmYomuh J3vZy7L4EGAUydldIaBHDHBs26cmji6pVTNAC63bJP2i5qmXEc3uAGehRnFPiPpi8DE4jzNue9 bVMqTFyhS//wI8ZYHSfnAqPAzILT5G53PVdmlex24fxd28TBW5xRKUB92fP720BSfU3DOGLaCB jwN2CZgcLl5Rd77S2iegN7PPG/JK4782dHArq36IPP/oczu4KZ613oyEEmsYxlDShzCtS0/yqT AqD9q8Z732V2pSKtjK3k41Ev5yoIJrHXTX5tvBhpe7uuIg==; 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=Qw2P072eazhBmfSG0DtbdnJYmB0FKVbpDiNY3Lh3R1c=; b=ABXOZP5gZgUOw06MvWZA0Zjwn+ bXm9tb+XhGV4t6fJ/EEg+cadKe8CCXoDH2E8mWZcDrgMus3dynutOZ5I5/BqZi1L5t5Zqmr41RrMA mBPwYYqlskSqBAhhr3as+eGxRRqitBlOzWMfwFwCV48mfUs5KuA0rnpJI6p+iFDgq8oOiVepyJx79 MsVBl/ghYKfpFupATDzmzx4h6NAlK6obEfhVuQfAbLuvXZYQW6zVIU+M6sYDBIFho34QLGAFOOUfc lKA3UMhLsLogIYy7xK2l5yDv7BA1dBoGzd5Wq3/CHDxTHmoZ7gYXjS3CqUvB2gmuYxVRR4+Ohtz8Y B/u+J/Sw==; Received: from authenticated user by zero.zsh.org with local id 1mf6C1-000ItC-0G; Mon, 25 Oct 2021 20:03:37 +0000 Authentication-Results: zsh.org; iprev=pass (mail-qk1-f169.google.com) smtp.remote-ip=209.85.222.169; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-qk1-f169.google.com ([209.85.222.169]:46799) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1mf6B9-000ICh-GQ; Mon, 25 Oct 2021 20:02:44 +0000 Received: by mail-qk1-f169.google.com with SMTP id h20so12813297qko.13 for ; Mon, 25 Oct 2021 13:02:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=Qw2P072eazhBmfSG0DtbdnJYmB0FKVbpDiNY3Lh3R1c=; b=HDAIIYhIrUk4bOalG03VHgRrV1QatCBexhrfIFYLW/s12G0UdJQOej10/g0zcxe16+ KBDm2yleN3lWUjuPfyjOIdzw6aU+stQ1jow59MCcKliUeQC/veO3MZ4BYSEoA2klTYs2 frIXW6XPNrU2N7O0X4+SiCW5/v+gUfx9M705GMnd8qx3NjlpS2oz4oUy4P6b51p9BgL4 4idW+YRX+g4l5img7Jn5grCSx/UohxJgsOGQK89zCYt6bC2yW3+TrWdwJBYCQpuIN5C9 amrYWIJsE8wPhkBuQAMBFppxeU4/jG7wh+/9Q7s0U9lyDG+szn6wzD3NRZlvFaVroSZM P/bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=Qw2P072eazhBmfSG0DtbdnJYmB0FKVbpDiNY3Lh3R1c=; b=dEdLkY50nSyZrlVS06FGDc9mHXbiPlo2EFvXhqP7vkqKiif+B1WAV9EM8shmSpqAav 6jq6+LMZin1vts/psAukn9rEi/HoVmgga1d7kppmf318/+D/R0pfSlSOflo33UOhxt+9 5THxolK6KW+AD3LySr2o411jJV8skCSUVJYRb9JLCGcZocF/WkCBjYNwm0EAfEproEgZ aEgWdiHZvS5PYYQ5ZTqAU1JJfqd1U2/CCHzBDJHLTIeOdz4oDcF8L0ZqlpFHSQxRaPy0 4bocNZFjcPRPkMNhQtnDCFxpEGKmj8p88oPMJVn5nUTwCsJjMK1esmzQJcf0l6KFdCEI Gi8A== X-Gm-Message-State: AOAM532llS2s9sdiHVmjLCAN0DXQO3grUAv2jc+yG52S4VZChg2q3iZ8 3dEe/pMXv+f1240UlZ+T/6Vv3zs+/FQ7+j2cwdDwIthU X-Google-Smtp-Source: ABdhPJwT3U5/FXpG0xxvH/r+/p06BYAt8D5N+pZCW8l0shAlGnh60uQJ2nUqgV8LCPViV3pKiCBpbrK9+6Yf164nSfg= X-Received: by 2002:a37:583:: with SMTP id 125mr15615019qkf.336.1635192162167; Mon, 25 Oct 2021 13:02:42 -0700 (PDT) MIME-Version: 1.0 References: <20211025194508.GB8612@tarpaulin.shahaf.local2> In-Reply-To: <20211025194508.GB8612@tarpaulin.shahaf.local2> From: Roman Perepelitsa Date: Mon, 25 Oct 2021 22:02:31 +0200 Message-ID: Subject: Re: Disabling null elision (was: Re: Most Recent File) To: Daniel Shahaf Cc: Zsh Users Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 27289 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: On Mon, Oct 25, 2021 at 9:45 PM Daniel Shahaf wrot= e: > > Roman Perepelitsa wrote on Sun, Oct 24, 2021 at 09:22:46 +0200: > > > It's one of the nice things about zsh that you can use the shorter > > $foo and $#foo instead of "${foo[@]}" and ${#foo[@]}. I wish there was > > an option to disable null elision with a corresponding expansion flag > > to turn it on similar to no_sh_word_split and ${(=3D)name} > > I'm in two minds about this. > > On the one hand, null elision breaks the principle of least surprise =E2= =80=94 > both in reference to other programming languages, and in reference to > SH_WORD_SPLIT's default behaviour being the unlike-Bourne-shell > behaviour. > > On the other hand, making it on by default would be backwards > incompatible, and making it off by default would mean there's yet > another syntax-changing option for everyone to keep in mind when they > review random autoloaded functions' code. How about a two-step approach with the possibility of stopping after the fi= rst? Step 1: Add an option to disable null elision. Off by default. Step 2: Make this option the default in native mode. I would be 99% satisfied with step 1. I would be less satisfied if step 2 was implemented because I hate when my scripts break. Granted, even step 1 will break "plugins" that attempt to work with any options but at least it won't break executable scripts. It's also nice that this option would affect parsing, only evaluation, so it won't be necessary to care about it when defining functions. I do get your point about the difficulty of reading plugins when you have to keep in mind all possible options that the code can be evaluated with (how many plugins work with no_glob? mine don't). I still think it's worth it to have *this* option. Dropping all those quotes would remove noise from code and make comprehension easier. I realise that few users would benefit from this. Not many write zsh scripts to begin with and a small number of those would enable a new option. Roman.