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,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 9206 invoked from network); 16 Apr 2021 06:47:35 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 16 Apr 2021 06:47:35 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1618555655; b=KSZdsYw1MTT+Dl0s85Kms+OM7C4UFqMhu+Fllwzy0MZ7HUKBrj4vqNYEXTnfEtHzGGr+GasxsA by+JgMEcy1Gh4Br4dpvrEJdosWxeqiHRUptXoyyphjUpknqkHu6UZg/eHppX0sxSduIr1ES1jr +f9RjduL7jYk6ph6pAZP/WGTwiy1kWUuD58FkyShQvZt5OXkvxKDA3RdwKPRbmDkIVnT55e2u8 RCUoYeZXOaKAuTxmm+xw+9i0IF64dA7sys+ThhN77LVHX9JGJutwOJwQl8uqQrZXdmBX7qvIkD GGQMayP/b0Al3In8BHPQQyIPZipCCyt6Yl138S2Z2LUK/g==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (aurora-borealis.phear.org) smtp.remote-ip=188.42.45.194; dkim=pass header.d=phear.org header.s=20180217 header.a=rsa-sha256; dmarc=none header.from=phear.org; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1618555655; bh=0rBJIgyIZPKEa3u0X2ioe34iko7Yx6UBquq8uV5CBjQ=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:DKIM-Signature:DKIM-Signature; b=1ri1y4hcJ8gXTpFClzp74/zKvycY2GMPBNp6UGLeEAjvXdtZpGPI0dd4TsT34P2AR3Dcjwi55b 9JSEoHMRA3jwXThNWsoA93ldZeeb4Li85/6hYM5C/UJ66HzVL5BI9b6wUUj5FozfKXBpGJB/3t GUOe6FD2b3H8/75E7vk6iDMXJ+/+I6VFlpouIkA+GztXqWCqeHxtYvRv5tPTqoua8VmOK6XgJB GhUhehAvsI83EERqgdTMSvdMQxHz+ZabxN80jYu+ekOp2l6aARO3Ex5DNjilVz4aLV3mr7bhOM iQUepi8yoiOmwC2l9Gh0a4EIiSyPx0ZgQXkgmUVvGQgWIw==; 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:In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=j8w3UNNs+QTYGcVKVDUDJKuIQIATBJDJhfHazM0OFKo=; b=lD9Kx7y/p99XETOjmQKsN1PVVV Hx9mHv+5q0a3pBp5l3plunjJ/L5s+qBhC7cNhiCtynnuPJOyy4GT3yKMuOb7Z5gSZ5R3/+hoLeTY2 Sw6WAXv5LoTtbhZRpsrRgOypi1kcTcdQQ2eavkbLO1lxKNzQw9+CcCcEvjYAVzSFQS7tmocQA4W8q rsQzHvlwt7qDPvJNQH9emu7RBwI0eKVvCeIxSd8SR8KESBjjhxknlUmGVUemEZPLqFkppypZRd9aS tBD27fe+3yQ7bDdBJJNVqltKJIhZg6tRh5kViQpy+Ko6yAKgj5Gq6OvsNzHJ2tPX/MHz8+x7/iVRD S2Ir8PaQ==; Received: from authenticated user by zero.zsh.org with local id 1lXIGL-0008Vu-UJ; Fri, 16 Apr 2021 06:47:33 +0000 Authentication-Results: zsh.org; iprev=pass (aurora-borealis.phear.org) smtp.remote-ip=188.42.45.194; dkim=pass header.d=phear.org header.s=20180217 header.a=rsa-sha256; dmarc=none header.from=phear.org; arc=none Received: from aurora-borealis.phear.org ([188.42.45.194]:45832) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1lXIFp-0007wN-BG; Fri, 16 Apr 2021 06:47:02 +0000 Received: from localhost (unknown [127.0.0.1]) by aurora-borealis.phear.org (Postfix) with ESMTP id 48507FF32; Fri, 16 Apr 2021 06:47:00 +0000 (UTC) X-Virus-Scanned: amavisd-new at phear.org Received: from aurora-borealis.phear.org ([127.0.0.1]) by localhost (mail.phear.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4OPGasCunu-T; Fri, 16 Apr 2021 06:46:58 +0000 (UTC) Received: from prometheus.u-strasbg.fr (82-65-50-238.subs.proxad.net [82.65.50.238]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: khatar) by aurora-borealis.phear.org (Postfix) with ESMTPSA id 09E7DFF0D; Fri, 16 Apr 2021 06:46:58 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.10.3 aurora-borealis.phear.org 09E7DFF0D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=phear.org; s=20180217; t=1618555618; bh=0rBJIgyIZPKEa3u0X2ioe34iko7Yx6UBquq8uV5CBjQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kSMAiV9eicG7sibfhuPQ7FkehAkdBwYePWuMCUXTahNWvLXa86e9l/Sfdp7z7kVUj Crc28L3gqxe3yNWUBArpW0Z9ScqYoZVP/rR+5LDFEAL+iH5uCpxrjYY9FVLya51+Sd /l3fxsUt47QDt/75Qg/lhzhcuNWnRcNoCbvZ8QQMaWm04o9XPHEgtkrHn1rL8meXxh v9uQpspJIus4DihVMHUJhdFOp4SDU4lcvPOiWfKBRj6Yp/5XGAQuZotTpqiK0sGnDf pmDzTq0OypTpxgSYkSIw4PbqfSP5uuvrYxm5IokJTmrc8EHAiYJD7o63AT3riojifd 9lKd9Y+F+I8gw== Date: Fri, 16 Apr 2021 08:46:55 +0200 From: Marc Chantreux To: Bart Schaefer Cc: zzapper , Zsh Users Subject: Re: (prefix case terminators?) Re: alias with a parameter Message-ID: References: <2902540a-9c07-4423-b0bb-6802af6e97a2@www.fastmail.com> <48bef9cb-fea7-1a17-96b1-dd4ae7bf54aa@spamtrap.tnetconsulting.net> <20210409224930.GB6760@tarpaulin.shahaf.local2> <41baeb56-de2f-2fb2-3544-ce703bf96223@rayninfo.co.uk> <6717f359-f340-a436-c2dd-1b9ae19d345a@rayninfo.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Seq: 26664 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: hello, > > i would have written ${1-} so -u can be used. > I'm not following that at all: -u where? oopps. sorry i was too fast writting this. i meant nounset option. i want my shell to yell at me as soon as i do something wrong so my ~/.zshenv starts with setopt warncreateglobal nounset pipefail > > also: i really think that using terminators as "continuation" > > ease the code reading > Entirely my opinion, but I find your example much MORE difficult to read. Thanks for the feedback! As always, i think everyone comes with cultural biases when it comes to coding style. when i read case "$var" in (a*) write ;; (b*) something ;; (c*) cool ;; esac i would like to see/write # in raku given $var { when /a*/ { write } when /b*/ { something } when /c*/ { cool } } # in rc switch ($var) { case a* ; write case b* ; something case c* ; cool } and i used to actually read/write # zsh case "$var" { (a*) write ;; (b*) something ;; (c*) cool ;; } because i though for many years that alternative syntax will replace the old one the way zshcompsys replaced zshcompctl. but: * it will never happen and i have to fall back with the classic syntax whenever i contribute to existing codebases. * i started replace zsh by dash or rc in my scripts whenever the awesomeness of zsh doesn't help a lot (which means "lot of them") so now i try to stick to POSIX syntax whenever it's easy to do it but i try to adapt the coding style so the code keep staying attractive to me. > > * it's easier to spot a different terminator than ;; > For that, I'd put the terminator on a line by itself, which I would > also do if the case branch was more than one line or if the case > pattern was quite long, but with short patterns and the terminators > all ;; it seems unnecessary. indeed. what i just did is to remove a "useless new line". ... some code there ;; (newcase) and ... some code there ;; (newcase) both to me and the interpreter and the second one looks much more natural to me. i'm not trying to convince anyone. i was really please to read your feedback so i try to share my opinion on it. regards marc