Deutsch English Français Italiano |
<20240405175329.336@kylheku.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder6.news.weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Kaz Kylheku <643-408-1753@kylheku.com> Newsgroups: comp.unix.shell,comp.unix.programmer,comp.lang.misc Subject: Re: Command Languages Versus Programming Languages Date: Sat, 6 Apr 2024 01:01:48 -0000 (UTC) Organization: A noiseless patient Spider Lines: 43 Message-ID: <20240405175329.336@kylheku.com> References: <uu54la$3su5b$6@dont-email.me> <20240329101248.556@kylheku.com> <uu6t9h$dq4d$1@dont-email.me> <20240329104716.777@kylheku.com> <uu8p02$uebm$1@dont-email.me> <20240330112105.553@kylheku.com> <uudrfg$2cskm$1@dont-email.me> <87r0fp8lab.fsf@tudado.org> <uuehdj$2hshe$1@dont-email.me> <87wmpg7gpg.fsf@tudado.org> <LISP-20240402085115@ram.dialup.fu-berlin.de> <LISP-20240402091729@ram.dialup.fu-berlin.de> <wrap-20240402092558@ram.dialup.fu-berlin.de> <uui7hf$3gona$1@dont-email.me> <uuj1o5$3pvnq$1@dont-email.me> <87plv6jv1i.fsf@nosuchdomain.example.com> <wwv5xwyifq8.fsf@LkoBDZeT.terraraq.uk> <if-20240404121825@ram.dialup.fu-berlin.de> <uund4g$ugsb$1@dont-email.me> <uuofjh$19pfd$1@dont-email.me> <uuq0fp$1lcgf$2@dont-email.me> <86frvzo01i.fsf@williamsburg.bawden.org> Injection-Date: Sat, 06 Apr 2024 01:01:48 +0200 (CEST) Injection-Info: dont-email.me; posting-host="087afdf11801ba099c0d8e1d4262b803"; logging-data="1792348"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/OUv9+CJ7nbc+zcBYJ2TBi3Tvtft2nPSM=" User-Agent: slrn/pre1.0.4-9 (Linux) Cancel-Lock: sha1:xF8036ALwAa319a1i+/D/WiZosc= Bytes: 2970 On 2024-04-05, Alan Bawden <alan@csail.mit.edu> wrote: > Lawrence D'Oliveiro <ldo@nz.invalid> writes: > > On Fri, 5 Apr 2024 09:17:37 -0000 (UTC), Muttley wrote: > ... > >> a = > >> b ? > >> c ? d : e > >> : f ? > >> g ? h : i > >> : j; > > > > Just use brackets. Saves a lot of pain. > > a=(b?(c?d:e):(f?(g?h:i):j)); > > A normal programmer would write something like: > > a = b ? (c ? d : e) : > f ? (g ? h : i) : > j; > > I.e., she would allow herself to use spaces and newlines, and just > enough parentheses to make the structure clear. It looks good, undeniably. However, I cannot tell at a glance whether or not the nice appearance isn't telling me some kind of lie. That's an inherent problem with the ternary operator. I have to remember that = has lower precedence than ?:. But, == has higher precedence. So this careless edit makes it wrong, even though it still looks just as nice: a == b ? (c ? d : e) : f ? (g ? h : i) : j; -- TXR Programming Language: http://nongnu.org/txr Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal Mastodon: @Kazinator@mstdn.ca