Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug with unset variables
- X-seq: zsh-workers 47675
- From: "Daniel Shahaf" <d.s@xxxxxxxxxxxxxxxxxx>
- To: "Felipe Contreras" <felipe.contreras@xxxxxxxxx>
- Subject: Re: Bug with unset variables
- Date: Fri, 27 Nov 2020 20:59:39 +0000
- Archived-at: <https://zsh.org/workers/47675>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-workers/2020-11/3246311e-c4b2-48f3-8baa-d271591f0029%40www.fastmail.com>
- Authentication-results: zsh.org; iprev=pass (out4-smtp.messagingengine.com) smtp.remote-ip=66.111.4.28; dkim=pass header.d=daniel.shahaf.name header.s=fm2 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm1 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none
- Cc: "Zsh hackers list" <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=mime-version:message-id:in-reply-to :references:date:from:to:cc:subject:content-type :content-transfer-encoding; s=fm2; bh=3c+5G6vh0Ws4Aa5EIi1IhU0Ser KpuO74CsiUl8pHqbM=; b=hUcjXqJRn6hoHfZWHxp4eEbBXSWqdMlQPjPCvakT1T 0PIFriFewfgSuPjM/mhIbAkoK7RQdhfjMeIzpQxraxV7nQ/6sGRQJoLADK5ralad GHjRUz1URSDFGpGz6cuZNBrRgSNWDKyw53qUZHoxzTKq2AUJjqU0/xfYh57CsXPH fOEz/AqgYFtAe9WAYt75H6d/6g5pOZCkOp2wDqqzLGF/i1DBE766ma3OU2FRnTqh 3NmChWNj+2l0ecnbaQ5fnEJQzqAujWSsJUIDQeBthzHDW4UcGUzTnQvv7gBldlOa U9bkIj/hqmoN2pjobd4pem8LvRduYD3NotPImz5e6EsA==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=3c+5G6vh0Ws4Aa5EIi1IhU0SerKpuO74CsiUl8pHq bM=; b=AZ3DP4Ajm/FqImzZPte4U0oA+eCajClfFV3lN17qqd9m5fT2fQ+1zt0Ll rvPOgfPYBj0192lIm8d9T8DPHiJ6si9H26wcJJlz6p2sC09pn8tjvYhdd8HdEuqU StyGkkT/c3DHzDCcYfS97mrnCudXfxJrnuWV6PIdPt1Z1hoaEhzLxX7mpDBSotye n6Q60Tbt8ocet6sR+cWPD7rQF5ld39jOqnMwr+WMJV8cr+PxAlbFBWveUPUnR8+6 QEOEz5s9NsAgq8VkiIFx9HKaDstHSDk1Bmq8CaFMmlPBWFZWzP6Rm8gPsFMsmkMn Sva1fZgBfQ1ajwGeDVRcU7U83hANQ==
- In-reply-to: <CAMP44s2mkpWF-2coUW6u-9W03puSDdhSoF_HNdVbSqohpxvLkQ@mail.gmail.com>
- List-archive: <http://www.zsh.org/sympa/arc/zsh-workers>
- List-help: <mailto:sympa@zsh.org?subject=help>
- List-id: <zsh-workers.zsh.org>
- List-owner: <mailto:zsh-workers-request@zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-subscribe: <mailto:sympa@zsh.org?subject=subscribe%20zsh-workers>
- List-unsubscribe: <mailto:sympa@zsh.org?subject=unsubscribe%20zsh-workers>
- References: <CAN=4vMqr-MBuzikqkSJEnY5=hW6xjv_TcW_paZV9oKEXnDsmrw@mail.gmail.com> <CAMP44s0sU0B1fQq=BEJV+jp_jtjxpFbz6K=wqNpukLK4i31P4g@mail.gmail.com> <CAH+w=7a3vOa2+YXpOS0eCGTr_TGNe1uhPBu+B1Xb_4OmmhJk1A@mail.gmail.com> <CAMP44s2LRtJLMc-RWX6_o7qO_cshfcuWL0-NtrWfqYp9o7HcEA@mail.gmail.com> <CAH+w=7YZQA=vhA=-jVzYLvP_XmrN6f5Ra8TH5LsMrza8GVsKvQ@mail.gmail.com> <CAMP44s1m3zNAeZ9Gn3XcG0pHeavD9K_eXOjZz3LGoUvdpzucVA@mail.gmail.com> <CAH+w=7bhs3BVrBMjbcxPhrxh0fXMKeBVooNknLts+4QxHQYOZA@mail.gmail.com> <CAMP44s0QMzJuMPoMZ1BR=+Y2_n4iEE-coXVtmFTdaHj4AuxTVw@mail.gmail.com> <CAH+w=7Z+Brh5KfwUJakoaKfQ39WQbYoRELyfpu3YO1Ro-Ewvfg@mail.gmail.com> <CAMP44s1RLs-ASYFyvjvj7eGta5_WnsXSH_8jAXf-Zufk569E1Q@mail.gmail.com> <20201127154439.GC26720@tarpaulin.shahaf.local2> <CAMP44s2mkpWF-2coUW6u-9W03puSDdhSoF_HNdVbSqohpxvLkQ@mail.gmail.com>
- Sender: zsh-workers-request@xxxxxxx
Felipe Contreras wrote on Fri, 27 Nov 2020 20:49 +00:00:
> On Fri, Nov 27, 2020 at 9:44 AM Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> >
> > 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 «typeset» does one thing — it ${verb}s a variable
> > (for some value of $verb) — and the zsh data model doesn't feature
> > a "Not really a value" value, so the variable necessarily gets _some_
> > value, like «int foo;» in C.
>
> If it's really one thing, then why does adding it in the example above
> changes the behavior in *two* ways?
What two ways?
> func () {
> [[ -n "$1" ]] && var=$1
> dosomething ${var-other}
> }
>
> func () {
> typeset var
> [[ -n "$1" ]] && var=$1
> dosomething ${var-other}
> }
>
> --
> Felipe Contreras
>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author