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=0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RDNS_NONE,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.4 Received: from authenticated user by zero.zsh.org with local id 1kikgb-000OMI-NS; Fri, 27 Nov 2020 20:49:45 +0000 Authentication-Results: zsh.org; iprev=pass (mail-wr1-f48.google.com) smtp.remote-ip=209.85.221.48; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-wr1-f48.google.com ([209.85.221.48]:42294) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1kikgL-000O7Y-JB; Fri, 27 Nov 2020 20:49:30 +0000 Received: by mail-wr1-f48.google.com with SMTP id l1so6818645wrb.9 for ; Fri, 27 Nov 2020 12:49:29 -0800 (PST) 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=IHA9ftREZCtsmJ4VC+9OgScgj8XGkgOFPWoLrvcdNVU=; b=F1kR6ukM1xWYA32mmcbmQ9LZ+NFO1JgMtKXS8CPZUV0lva6G+d8MiysdK3rRnRRQp+ z2Xd5nZZ1B3Fsxg2mC/v9Y3pkuaNAeVFS46FCEgR2fyseHJo9k3dn2/qBidUJ+oi4o4I hqI4jFA8aXB9fTt/5GLOgImYC9CaYV7vYFj6AnmNaO/B026bcsLbUnutl5JCR9KqnE3D WsuJAF5sfwAFkjhVxeMxCXpyPlZxEKK+r3vnnArtMTlKx0cZKINIy9se/2JSkoQNo5eo V+1QcrN5mm9qlS/ky0iZrvWFAt6eVexQIvhZlp9G7AGrzdwJQ+SQvZib8ivKNrPPYRqD T9bg== 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=IHA9ftREZCtsmJ4VC+9OgScgj8XGkgOFPWoLrvcdNVU=; b=OTA6csLSmETfFst/uxVbHG0Jp+cu0KhbagviG73dRBSom9lYiddt63k/lPYw7i9mxk C+vZm00QL0eh9hGRjlEl4exTVNM3qfCKGnR01UwZti9KC5llxnyif6M1bTKCSM0rrB0P NOQKpAMQo+BBV+VNOxoxAMgMkIwgqQ4fmOPneM7QKeWUK89fZzj01ueE90XNC6jGct56 6xAaISdBp8A1lGfbYHzmaZHMInyan2yOGt4ndSCBvZKAAXGTXnUCIq0N4YXI2uF4PuF/ VbzzLnUrRYvY22SoqyTwsQdV4nohwRavk9qYBpCq4bZCTOnoOrVnSdilZfbDL3Gd1tWO +hkQ== X-Gm-Message-State: AOAM532GF9QbaYTKQSX6jay5/I8SKzvgp1F37c/YX3mTyTk/7nH+Ebnb uYpC5d23lvGauT8CGwzuo5xQfvJE8KkLjfFa+cWjwqrw6ixjAw== X-Google-Smtp-Source: ABdhPJz9Jm8Y6zY1SoSMsRzcqgAI4tBjIkQlTwEnN94QVxFlWrpg08RB3QYGfc3GiJ4WxRyoSfTKhPtmMrJJuhJLpf4= X-Received: by 2002:a5d:474f:: with SMTP id o15mr13252513wrs.100.1606510169240; Fri, 27 Nov 2020 12:49:29 -0800 (PST) MIME-Version: 1.0 References: <20201127154439.GC26720@tarpaulin.shahaf.local2> In-Reply-To: <20201127154439.GC26720@tarpaulin.shahaf.local2> From: Felipe Contreras Date: Fri, 27 Nov 2020 14:49:17 -0600 Message-ID: Subject: Re: Bug with unset variables To: Daniel Shahaf Cc: Bart Schaefer , Zsh hackers list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 47673 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: Archived-At: On Fri, Nov 27, 2020 at 9:44 AM Daniel Shahaf wrot= e: > > Felipe Contreras wrote on Wed, Nov 25, 2020 at 02:46:40 -0600: > > Maybe there's a better way to describe this fact. Maybe Git's notion > > of logically separate changes [1] helps (e.g. you should not mix > > whitespace cleanups with functional changes). But the fact is that in > > virtually all languages (and bash and ksh) there's an idiom to declare > > a local variable and *only* declare a local variable (not do anything > > else). > > > > Can we at least agree on that? In zsh typeset does *two* things. > > I'd rather say that =C2=ABtypeset=C2=BB does one thing =E2=80=94 it ${ver= b}s a variable > (for some value of $verb) =E2=80=94 and the zsh data model doesn't featur= e > a "Not really a value" value, so the variable necessarily gets _some_ > value, like =C2=ABint foo;=C2=BB in C. If it's really one thing, then why does adding it in the example above changes the behavior in *two* ways? func () { [[ -n "$1" ]] && var=3D$1 dosomething ${var-other} } func () { typeset var [[ -n "$1" ]] && var=3D$1 dosomething ${var-other} } --=20 Felipe Contreras