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


Groups > comp.lang.c++ > #85798

Re: map[string_view] not compiling

From Juha Nieminen <nospam@thanks.invalid>
Newsgroups comp.lang.c++
Subject Re: map[string_view] not compiling
Date 2022-08-04 06:16 +0000
Organization Aioe.org NNTP Server
Message-ID <tcfo8c$nti$1@gioia.aioe.org> (permalink)
References <tc8epl$t0hn$1@dont-email.me> <tcdff0$25305$1@dont-email.me> <tcdjrf$1dc1$1@gioia.aioe.org> <tcdmmu$26sqq$1@dont-email.me>

Show all headers | View raw


Alf P. Steinbach <alf.p.steinbach@gmail.com> wrote:
> On 3 Aug 2022 12:49, Juha Nieminen wrote:
>> Alf P. Steinbach <alf.p.steinbach@gmail.com> wrote:
>>>      using   std::less,
>>>              std::map,
>>>              std::out_of_range,
>>>              std::string,
>>>              std::string_view,
>>>              std::forward;
>> 
>> I love how you use 92 characters (and six lines of code) in order to
>> avoid writing "std::" three times, which would be a total of 15 characters.
>> Thus you saved a total of -77 characters and -6 lines of code.
> 
> Noted, that the measure of number of letters is important to you.

It should be a rather obvious thing that it's sarcasm, and pointing out the
irony that by trying to type less you are only typing more. By trying to
save work you are only doing more work. And for what? Just to make the
actual code less readable.

>> While, at the same time, making the code less readable.
> 
> While at odds with objective reality (e.g. amount of text to parse), and 
> also at odds with your own above stated preference for succinct code, 
> i.e. contradicting yourself,

The "using" statements there are not code per se. They don't do anything.
They only exist to make the code shorter later. In other words, they
exist for the goal of brevity-over-clarity.

Avoiding brevity-over-clarity is not about the total length of the code,
but about the readability of the code. There are many ways to make code
less readable, and one of them is to use names that are too short. The
goal of avoiding brevity-over-clarity is not to make the code longer,
but to make it more readable.

Your excessive use of 'using' isn't achieving that, but the opposite.

> here you're unfortunately in line with a 
> great many C++ programmers which by now may even constitute a majority.

Have you ever thought there may be a good reason for it?

There are two types of people reading your code: You, and everybody else.
Unfortunately quite often the ease of understanding of the code is very
different for those two groups of people. (And, in fact, you yourself
will eventually become part of the latter group over the years, with
respect to code you write today. The more time passes, the less you'll
remember what you wrote and the more the (un)readability of your code
will start affecting even you yourself, if you ever come back to your
own code.)

Back to comp.lang.c++ | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

map[string_view] not compiling Paavo Helde <eesnimi@osa.pri.ee> - 2022-08-01 14:52 +0300
  Re: map[string_view] not compiling Bo Persson <bo@bo-persson.se> - 2022-08-01 14:32 +0200
    Re: map[string_view] not compiling Paavo Helde <eesnimi@osa.pri.ee> - 2022-08-01 17:11 +0300
      Re: map[string_view] not compiling Öö Tiib <ootiib@hot.ee> - 2022-08-01 13:30 -0700
        Re: map[string_view] not compiling Bo Persson <bo@bo-persson.se> - 2022-08-01 23:23 +0200
          Re: map[string_view] not compiling Öö Tiib <ootiib@hot.ee> - 2022-08-01 22:52 -0700
    Re: map[string_view] not compiling Andrey Tarasevich <andreytarasevich@hotmail.com> - 2022-08-04 08:31 -0700
  Re: map[string_view] not compiling "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2022-08-03 11:34 +0200
    Re: map[string_view] not compiling Juha Nieminen <nospam@thanks.invalid> - 2022-08-03 10:49 +0000
      Re: map[string_view] not compiling "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2022-08-03 13:38 +0200
        Re: map[string_view] not compiling Juha Nieminen <nospam@thanks.invalid> - 2022-08-04 06:16 +0000
    Re: map[string_view] not compiling Paavo Helde <eesnimi@osa.pri.ee> - 2022-08-03 14:43 +0300
      Re: map[string_view] not compiling "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2022-08-03 13:56 +0200

csiph-web