Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #39976

Re: Understanding &&

Path csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.javascript
Subject Re: Understanding &&
Date Sun, 18 Apr 2021 17:26:18 +0100
Organization A noiseless patient Spider
Lines 46
Message-ID <8735vn7e51.fsf@bsb.me.uk> (permalink)
References <U_CdnQWSXulHj-T9nZ2dnUU7-evNnZ2d@westnet.com.au> <slrns7ishn.4j8.jon+usenet@raven.unequivocal.eu> <87wnt2e06e.fsf@bsb.me.uk> <slrns7jb5v.4j8.jon+usenet@raven.unequivocal.eu> <87mttydm95.fsf@bsb.me.uk> <slrns7jv2m.4j8.jon+usenet@raven.unequivocal.eu> <87o8edd8qk.fsf@bsb.me.uk> <ie16v3Fb26cU1@mid.individual.net>
Mime-Version 1.0
Content-Type text/plain
Injection-Info reader02.eternal-september.org; posting-host="cebc7205e7af165aaf5b3baa2f235ea5"; logging-data="17417"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18k/f77od8XAjbTWGaztVFJkGYaNTwYN9k="
Cancel-Lock sha1:fSqZ0pENEMZ/qopcABJaFNRxqMI= sha1:PHVr0VUnNUDQZr0JJZ0KZi3M3aw=
X-BSB-Auth 1.115429f8e0f6ea121e40.20210418172618BST.8735vn7e51.fsf@bsb.me.uk
Xref csiph.com comp.lang.javascript:39976

Show key headers only | View raw


Arno Welzel <usenet@arnowelzel.de> writes:

> Ben Bacarisse:
>
>> Jon Ribbens <jon+usenet@unequivocal.eu> writes:
> [...]
>>> It's not a rule of mine, it seems to be a rule of almost everyone.
>> 
>> The trouble is that a non-trivial number of languages have this form,
>
> Yes - but this is more a side effect than a intended way to use those
> languages.

I think that's likely in most cases, but Perl added 'and' and 'or' with
the same semantic as it's existing && and || but with much lower
precedence so that they could be used for this kind of thing more
easily.

> [...]
>> I've seen (and, dare I say, written) code that uses the result.  I
>> wonder if that absolves the programmer from the charge of abuse:
>> 
>>   return (data = parse_input(file_name))
>>       && (result = transform(data))
>>       && write_file(file_name);
>
> In a polite way I'd say this is the result of someone who is really lazy
> and want's to avoid typing as much as possible. That's ok if you do a
> project just for yourself. But as soon as you need to work in a team,
> readibility *is* more important than having the shortest possible
> code.

I never aim to the shortest code, but readability is not an absolute.
Who is doing the reading?  Do we assume, for the purposes of assessing
readability, the very lowest absolute minimum understanding?  I don't
think I've worked with any colleagues who would have the slightest
trouble reading that statement.  I fully admit that my experience is
probably atypical, but some people just work in an environment with
different notions of what is hard to read.

By the way, I'm not suggesting that there could not be other good
reasons to re-write such things, just that there may be environments in
which its readability would not come up as an issue.

-- 
Ben.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Understanding && Andrew Poulos <ap_prog@hotmail.com> - 2021-04-16 14:30 +1000
  Re: Understanding && Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-16 11:00 +0100
  Re: Understanding && Jon Ribbens <jon+usenet@unequivocal.eu> - 2021-04-16 11:17 +0000
    Re: Understanding && Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-16 16:09 +0100
      Re: Understanding && Jon Ribbens <jon+usenet@unequivocal.eu> - 2021-04-16 15:26 +0000
        Re: Understanding && Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-16 21:09 +0100
          Re: Understanding && Jon Ribbens <jon+usenet@unequivocal.eu> - 2021-04-16 21:06 +0000
            Re: Understanding && Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-17 02:01 +0100
              Re: Understanding && The Natural Philosopher <tnp@invalid.invalid> - 2021-04-17 08:33 +0100
              Re: Understanding && John G Harris <niam@jghnorth.org.uk.invalid> - 2021-04-17 12:06 +0100
                Re: Understanding && The Natural Philosopher <tnp@invalid.invalid> - 2021-04-17 14:13 +0100
                Re: Understanding && Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-17 15:50 +0100
              Re: Understanding && Jon Ribbens <jon+usenet@unequivocal.eu> - 2021-04-17 15:21 +0000
                Re: Understanding && Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-17 23:46 +0100
                Re: Understanding && Jon Ribbens <jon+usenet@unequivocal.eu> - 2021-04-17 23:46 +0000
                Re: Understanding && Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-18 23:59 +0100
                Re: Understanding && Jon Ribbens <jon+usenet@unequivocal.eu> - 2021-04-19 13:56 +0000
                Re: Understanding && Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-19 23:08 +0100
                Re: Understanding && Jon Ribbens <jon+usenet@unequivocal.eu> - 2021-04-19 22:52 +0000
                Re: Understanding && Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-20 01:23 +0100
                Re: Understanding && Jon Ribbens <jon+usenet@unequivocal.eu> - 2021-04-20 01:08 +0000
              Re: Understanding && Arno Welzel <usenet@arnowelzel.de> - 2021-04-18 00:49 +0200
                Re: Understanding && Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-18 17:26 +0100
          Re: Understanding && Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2021-04-17 17:05 +0200
            Re: Understanding && Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-17 23:04 +0100
              Re: Understanding && Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2021-04-18 00:48 +0200
                Re: Understanding && Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-18 17:13 +0100
                Re: Understanding && Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2021-04-19 21:58 +0200
            Re: Understanding && John G Harris <niam@jghnorth.org.uk.invalid> - 2021-04-18 18:20 +0100
          Re: Understanding && Arno Welzel <usenet@arnowelzel.de> - 2021-04-18 00:40 +0200
            Re: Understanding && Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-18 00:14 +0100
              Re: Understanding && Jon Ribbens <jon+usenet@unequivocal.eu> - 2021-04-18 00:01 +0000
                Re: Understanding && Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-18 17:44 +0100
                Re: Understanding && Jon Ribbens <jon+usenet@unequivocal.eu> - 2021-04-18 17:51 +0000
              Re: Understanding && Arno Welzel <usenet@arnowelzel.de> - 2021-04-19 13:41 +0200
                Re: Understanding && John G Harris <niam@jghnorth.org.uk.invalid> - 2021-04-19 15:02 +0100
                Re: Understanding && The Natural Philosopher <tnp@invalid.invalid> - 2021-04-20 17:40 +0100
                Re: Understanding && John G Harris <niam@jghnorth.org.uk.invalid> - 2021-04-20 18:19 +0100
                Re: Understanding && The Natural Philosopher <tnp@invalid.invalid> - 2021-04-21 10:11 +0100
                Re: Understanding && John G Harris <niam@jghnorth.org.uk.invalid> - 2021-04-21 19:46 +0100
                Re: Understanding && The Natural Philosopher <tnp@invalid.invalid> - 2021-04-22 13:48 +0100
                Re: Understanding && Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-19 21:28 +0100
                Re: Understanding && Jon Ribbens <jon+usenet@unequivocal.eu> - 2021-04-19 21:56 +0000
                Re: Understanding && Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-19 23:13 +0100

csiph-web