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.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,RDNS_NONE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: from authenticated user by zero.zsh.org with local id 1kikqq-000P8F-Ae; Fri, 27 Nov 2020 21:00:20 +0000 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 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:34997) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1kikqW-000Oth-WD; Fri, 27 Nov 2020 21:00:02 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 55C755C0175; Fri, 27 Nov 2020 16:00:00 -0500 (EST) Received: from imap37 ([10.202.2.87]) by compute3.internal (MEProxy); Fri, 27 Nov 2020 16:00:00 -0500 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== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudehgedgudeghecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvufgtgfesthhqredtreerjeenucfhrhhomhepfdff rghnihgvlhcuufhhrghhrghffdcuoegurdhssegurghnihgvlhdrshhhrghhrghfrdhnrg hmvgeqnecuggftrfgrthhtvghrnhepfefhkeefveeileelheeiffdtkedujeelvdfhtdej tdeggedvuefffeelhefhvdfgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepugdrshesuggrnhhivghlrdhshhgrhhgrfhdrnhgrmhgv X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 17BAC190006D; Fri, 27 Nov 2020 15:59:59 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.3.0-622-g4a97c0b-fm-20201115.001-g4a97c0b3 Mime-Version: 1.0 Message-Id: <3246311e-c4b2-48f3-8baa-d271591f0029@www.fastmail.com> In-Reply-To: References: <20201127154439.GC26720@tarpaulin.shahaf.local2> Date: Fri, 27 Nov 2020 20:59:39 +0000 From: "Daniel Shahaf" To: "Felipe Contreras" Cc: "Zsh hackers list" Subject: Re: Bug with unset variables Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Seq: 47675 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: Felipe Contreras wrote on Fri, 27 Nov 2020 20:49 +00:00: > On Fri, Nov 27, 2020 at 9:44 AM Daniel Shahaf = 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 noti= on > > > 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 dec= lare > > > a local variable and *only* declare a local variable (not do anyth= ing > > > 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 = ${verb}s a variable > > (for some value of $verb) =E2=80=94 and the zsh data model doesn't f= eature > > a "Not really a value" value, so the variable necessarily gets _some= _ > > value, like =C2=ABint foo;=C2=BB in C. >=20 > 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=3D$1 > dosomething ${var-other} > } >=20 > func () { > typeset var > [[ -n "$1" ]] && var=3D$1 > dosomething ${var-other} > } >=20 > --=20 > Felipe Contreras >