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 27449 invoked from network); 11 Nov 2020 21:09:32 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 11 Nov 2020 21:09:32 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1605128972; b=tKeY5tLwcLIumrrW0+zdqIxwtvtBhbwXB9l1e9OAGfcub36sBkNiaAX+JZ9CTBUHC2MEhtCCfq U21lV6wuKgjs+15tGQxfPuI2GrBOatVHVL75eT+uMz0l1cAbQzWErFFu0lC7s5OBaLv3iRIeMF sgv4K1oKR+uePubjngsgHz7Hi2TvhIvgN6Cq7h8lafMvFqXPoZ/KvtvD7YZViWXXvBY9Xy4LxB Il+WDWuGoHeJncMqMhctDzGVzrd7vTDb6fM2Ieygj+Gtd9TW73/cTTnaXTMngJjHW0WfvwpwbT Y46/v/X/Napld1D2SZBGr2C0StFIili3IJ51Ce8203Psiw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-wr1-f52.google.com) smtp.remote-ip=209.85.221.52; dkim=pass header.d=gmail.com header.s=20161025 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-20200801; t=1605128972; bh=KPZ54AWunLEErTBYYd9m2VxlUZcbZqqmi1DJXwzH5Us=; 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=aIbPnxCfmsH4Q5G0r51948sWw930F4iQ/fqLl7aejvUSFpoCjIZ91eVP/H5RuFfIeK/dHhjxoS E6PrIDqVixfuOfMGniRz8Jf74UAoJ7Fd6OWY107M5sWc1rDqh0JIxj48RgHfFbDXHPm883cfQ9 t85O2hjbzupC/SyRa34dm/x7A4bmXF2Mb35QtPjxBd3A3RhhhTNivOe81x4WZmUdw+UHCU+5Rg 5T1V74+zCBuyszEJqTRfKg+HHOPPgitJ031X1cDBVMa8tJQ/fX1Lvm7BH11M8KFdP/hwx2yWkc QerbqBEB8fFAXc1ksatreiDLRZiVlEKAcUTvYG8E8EdDzQ==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; 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=WGKLBuYuVvB01B1UCrv/MwfJRK8AoEoTmF1VUtNr9D8=; b=ZPTWHoHD/OGFL21WxyqDpx9Hiu Yvw19FIGglD/fTC5QezGYEAsd7YOVmvFA6QPVR4IE5MXmVS/w2HgAY29xSePSovPBeJOo43HKrUPa KVzLC39t7bMwWI3tH6SM1Ku8ZShNWLiWbSr8EUENQOccwfKwWtE/oM4YbLGEb4AnpLyOrCVhY+ya/ vDfnhRFi5LwhGX0GUkyQu3xbmoTHToxByNoHGtBqfgOfk41ksjOCJkH5wwIN2y1/kh98yU9uyeIAe 9oZN352IXlsefFxQvzb3Xeb1xBe1KtN2F/86Th6RW9uyb7CtpWz4SFnfsndnBOPE0Cq6jc8JAV5Y+ 2IM7mOdA==; Received: from authenticated user by zero.zsh.org with local id 1kcxMy-000DcH-IT; Wed, 11 Nov 2020 21:09:32 +0000 Authentication-Results: zsh.org; iprev=pass (mail-wr1-f52.google.com) smtp.remote-ip=209.85.221.52; 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-f52.google.com ([209.85.221.52]:44033) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1kcxMc-000DS7-5P; Wed, 11 Nov 2020 21:09:10 +0000 Received: by mail-wr1-f52.google.com with SMTP id c17so3845036wrc.11 for ; Wed, 11 Nov 2020 13:09:10 -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=WGKLBuYuVvB01B1UCrv/MwfJRK8AoEoTmF1VUtNr9D8=; b=jnTjHfqc3ex+lguZvI7q/NhtpZlP56uPNo3aAluYMM5gZoj6nvGHX6M8fzv9Q/0aAa zY2lRP9QOdiL18KDMOx04+yfQw9lQPiRg/yLNqJu77cF2CAnGacwdn1Xo99GbgKZMF/T F2au0G7UIRxqSMOaK+5U9DNysNHhkKpp0EisgO57tbGUD9CHc1yjZmKMu9S3mg7Qo0aS UCwRrkCvhx0doSkp8tQEd/xP5u+75DTz9XuxkFUgSEVrfqQOiYqlkEBAk0jpSt8jufYT JZzcUjykQculxgne8PZVYY+WFiU2OxyCZN8BHMc1h+EgPaqxN5IFJWxAOGwHnpdvPtJz /sew== 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=WGKLBuYuVvB01B1UCrv/MwfJRK8AoEoTmF1VUtNr9D8=; b=DBKX6S63C2sRwDJ/oyq8ITh0T76bNljl1nbGPKOgnuIRAyryc5QP3qFxPgmdKyMWEK 9ejQWOsTn1lVfxpsHoD2kfgJEN0w/7m7MYxwOSc0AV8EYYYKjwPqGVk4KPhzCXV9SCsf M3aAMtwcTS5i/kD282k/l40lLUBTeyRkt4oZIK3gQfTGa5I9KaJxe1dRlblsEb7WLZMl eiLDZ6kROf2wXzsJpNwkmYo51+EJqNG5JPqs++j56tskD3Gvly15hQ6qO42SydFz6xyG st1FVlyv4c6ROxRwJmYsH5WJMO7cbXjyJV4f/Abkh+3TXm7F8mtcH6OuT9PHr4xez6U/ vB9Q== X-Gm-Message-State: AOAM530ZvO39hbALuMNdhdYQZP1F7i6UqSA5TJFdqYXOn3lv8gLK+mCt jL7SG1ocIkuVBFwd3hodEr2JzhHGI0piWqMnFaw= X-Google-Smtp-Source: ABdhPJyK/qp9/oCHlr6bwkQrNCPLgSzMLueWedYBb8VPk8c5vfsMXnaIgrnxzA5L7wkVH7IuMGQGKwJL6MocT3oDZWU= X-Received: by 2002:a5d:52c1:: with SMTP id r1mr11710861wrv.255.1605128949670; Wed, 11 Nov 2020 13:09:09 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Felipe Contreras Date: Wed, 11 Nov 2020 15:08:58 -0600 Message-ID: Subject: Re: Bug with unset variables To: Bart Schaefer Cc: Roman Perepelitsa , Zsh hackers list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 47541 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 Wed, Nov 11, 2020 at 12:36 PM Bart Schaefer wrote: > On Wed, Nov 11, 2020 at 10:04 AM Felipe Contreras wrote: >> And what is the reason why this is not the default? > > Remember that doc Daniel quoted? > > 30 years-ish ago, when implementing zsh as a new shell from scratch, that= documentation was used to decide the behavior. At that point the other sh= ells that supported "typeset" were not freeware -- they required expensive = licenses or were bundled with commercial operating systems. So the impleme= ntation followed the doc (sometimes, it followed a misunderstanding of the = doc, which is why for example zsh syntax to specify integer bases differs f= rom ksh) without examples to which to compare. > > Zsh development has always followed a principle of NOT arbitrarily breaki= ng past usage without an extremely good reason (something I wish other APIs= would have taken to heart over the years ... IMO there would be much less = abandonware sitting in metaphorical dustbins ... but I digress). So by the= time anyone noticed, the behavior you see now was standard practice for zs= h in its default modes. This is *in general* a good principle to follow, and it does indeed salvage plenty of projects from the dustbin, but that doesn't mean the rule must be necessarily unquestionably followed. I argue there almost always is a sweet spot. While almost always it's bad to break APIs, not changing them ever also sends projects to the dustbin. The biggest mistake projects make isn't breaking API, but *how* they do it. There are few disadvantages of setting a flag to turn on the new behavior so that people can try it, then enabling the flag by default, while always leaving the possibility to turn the flag off for the people that prefer the old behavior. Doing this once say every 10 years seems like a sensible thing to do. Just have a list of all these proposed changes so they don't get lost. That's what major versions are for. > Your original example can use ${var:-other} if empty string has no explic= it meaning in context. I know, but it does have meaning. It is a suffix, so I want to use a space by default "${sfx- }", but only $sfx is unset, it can be set with an empty value, in which case I don't want any suffix. And it's not even my code, it's bash code I'm trying to emulate and leverage from zsh. >> Either way, if "emulate ksh" is supposed to emulate ksh, then it's not >> working properly in this instance. > > Despite the name, "emulate ksh" is not supposed to perfectly emulate ksh.= All it does is change the values of "setopt" to match ksh as closely as p= ossible. A more complete emulation is achieved by actually starting zsh fr= om a symlink named "ksh" (or one of a few equivalent ways). Same goes for = "sh" and "bash" (although there is little difference for those two). Right, but if virtually all shells do this, and it is a known discrepancy, and I'd argue it's the behavior that makes the most sense, I think it makes sense to have a flag for it. Cheers. --=20 Felipe Contreras