From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Xiyue Deng Newsgroups: gmane.emacs.bugs Subject: bug#67669: 29.1; Drop text suggesting using `and' to replace `if' Date: Thu, 07 Dec 2023 11:54:20 -0800 Message-ID: <87bkb1u6tv.fsf@debian-hx90.lan> References: <87v89buhpl.fsf@debian-hx90.lan> <83sf4e34s8.fsf@gnu.org> <87r0jytm58.fsf@debian-hx90.lan> <83a5qm2u8v.fsf@gnu.org> <87fs0ducme.fsf@debian-hx90.lan> <83v89928xe.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27112"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 67669-done@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 07 20:55:05 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rBKSf-0006ql-F2 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 07 Dec 2023 20:55:05 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rBKSU-0005tF-ND; Thu, 07 Dec 2023 14:54:54 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rBKSQ-0005pW-CZ for bug-gnu-emacs@gnu.org; Thu, 07 Dec 2023 14:54:50 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rBKSQ-000641-4k for bug-gnu-emacs@gnu.org; Thu, 07 Dec 2023 14:54:50 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rBKSc-0006SQ-3L for bug-gnu-emacs@gnu.org; Thu, 07 Dec 2023 14:55:02 -0500 Resent-From: Xiyue Deng Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Thu, 07 Dec 2023 19:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 67669 X-GNU-PR-Package: emacs Mail-Followup-To: 67669@debbugs.gnu.org, manphiz@gmail.com, manphiz@gmail.com Original-Received: via spool by 67669-done@debbugs.gnu.org id=D67669.170197888424779 (code D ref 67669); Thu, 07 Dec 2023 19:55:01 +0000 Original-Received: (at 67669-done) by debbugs.gnu.org; 7 Dec 2023 19:54:44 +0000 Original-Received: from localhost ([127.0.0.1]:43186 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rBKSJ-0006Rb-J8 for submit@debbugs.gnu.org; Thu, 07 Dec 2023 14:54:43 -0500 Original-Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]:58807) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rBKSG-0006RK-2H for 67669-done@debbugs.gnu.org; Thu, 07 Dec 2023 14:54:41 -0500 Original-Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1d05e4a94c3so11744145ad.1 for <67669-done@debbugs.gnu.org>; Thu, 07 Dec 2023 11:54:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701978861; x=1702583661; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=1+e7dPVPAheFxBVQioi6Hi+WFLZSTpzstIuvWeOGj54=; b=W+J36CPFKm4kxPKrkrj1wlk+d406B5xPp4dAg+dEllnpdfqdaJTWk2MpWfYg0ELAyB hBLfD9peLIUO5K47zEjzwTkcGj5YfnNjBuEcyJ6Q9x3Pp+1C5gY9+0zt37fze7wmC2ss cmodi1zxFWOTR9+PPjP4CzauN5m1wk7D5wKBhfsJdbdmWxCwnO5lT2Pci6XH5ZhQ552N P0Tx584DavEEuY7/Zw9eUO2GrOjcxpNxzcnF+uT15XzpX2hJAoH5Hq7/l7GtFSEn3CuX IEQDn6ZX8d++sW4olfKcu5i5YTjUOleh4ybebVylFTEjJxlWkcuL2Mxqmp+IYdczu/X2 U/Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701978861; x=1702583661; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=1+e7dPVPAheFxBVQioi6Hi+WFLZSTpzstIuvWeOGj54=; b=j8xHKpgqtIoNXnXecwBCqOkaNopMT910CK5lmI/33/kM5x4/MX3q/HB3g4eOjR6mpU 47WRu3ykE6RhJfhdkbBiwrLwIXAe3gUvnbDT6En7VtuPmIOxC+ulkYpPpRf6CrhT2GxL dmX2Q8zXruBf+Bk0GOyyTIXSqIB+63sXyu5j0cQZ9cXwxe/ya6K0A99I+ta70VPfhf3O Cr+PYOtpaqQwWy+RwJzDrxODXx6Bgpr90p/L+OjYNKH5nbj8Iht9d2H4c15EcCD8lCIq 1R1Ycn7hC2AWtYvmTaiXXDsp7VkMG2k4x5tfzcM54y3lTK3VdsayKjYhkBtNHYc3bmpg LV8Q== X-Gm-Message-State: AOJu0Yzb7UnmmslAM4YwkZ4Mf+HvOpIcEv6tmGeIF8gFvO8OEPHq3j6v Q8skZ89tLd6+/GyXamCNDLzW4YmVU7BTCw== X-Google-Smtp-Source: AGHT+IEjvErVx9eM9uvu7QQ62bbKm2fwWv6v+iTTnSLzvJswBZ/IF0aJc7LnxftUB4+CozzxEyXeaA== X-Received: by 2002:a17:903:187:b0:1d0:c1fe:694c with SMTP id z7-20020a170903018700b001d0c1fe694cmr3817358plg.47.1701978861430; Thu, 07 Dec 2023 11:54:21 -0800 (PST) Original-Received: from debian-hx90 (2603-8000-a400-0cdc-93f0-c81c-5fa0-c77c.res6.spectrum.com. [2603:8000:a400:cdc:93f0:c81c:5fa0:c77c]) by smtp.gmail.com with ESMTPSA id z4-20020a170902ee0400b001cfc44aac0fsm197278plb.111.2023.12.07.11.54.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 11:54:21 -0800 (PST) In-Reply-To: <83v89928xe.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 07 Dec 2023 19:56:29 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:275700 Archived-At: Eli Zaretskii writes: >> From: Xiyue Deng >> Cc: 67669@debbugs.gnu.org >> Date: Thu, 07 Dec 2023 09:49:13 -0800 >> >> Agreed on the point of being educational, and of course in the end >> coding style is mostly a matter of personal preference. However, I >> would argue a bit that in such case we wouldn't need `if' or `when' at >> all as both can be emulated by `and' and `or' if you are careful enough. >> On the other hand, `if' and `when' should exist for a reason. I quite >> like this suggestion[1] that `if' and `when' are used to guard side >> effects, whereas `and' and `or' are used for pure functions. >> Interestingly the current example you quoted changed from using `and' >> (as in the old version I quoted) to `if' probably based on this >> reasoning. Similarly I wouldn't suggest to replace `if' with `and' in >> the original example around the text we are discussing: >> >> (if interprogram-cut-function >> (funcall interprogram-cut-function string (not replace)))) >> >> as we are also guarding a side effect here. >> >> Wdyt? > > Sorry, I don't understand what you mean by "guarding a side effect", I was referring to whether we care about and use the result of the statement/function call. In `and' we do, in `if' we don't and we just use the side effect. > and I'm not sure where this discussion goes. If the issue is personal > stylistic preferences, then I'd prefer to leave the text as it was > according to the preferences of the original author (which I happen to > share, but that's not important). > > OK? As I was just trying to argue just "a bit", I won't be insisting either. Thanks for listening, and let me close this. -- Xiyue Deng