Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #70735
| Subject | Re: Two silly problems |
|---|---|
| Newsgroups | comp.lang.c++ |
| References | (2 earlier) <qu401n$vh4$1@dont-email.me> <4sqNF.162115$eP4.139233@fx23.dcg> <qu5kmb$qvh$1@dont-email.me> <gyxNF.89127$3sa.52754@fx02.dcg> <qu6t75$tus$1@dont-email.me> |
| From | Mr Flibble <flibble@i42.removethisbit.co.uk> |
| Message-ID | <5SKNF.20703$vj3.18073@fx10.dcg> (permalink) |
| Organization | http://www.NewsDemon.com |
| Date | 2019-12-28 15:51 +0000 |
On 28/12/2019 06:37, Alf P. Steinbach wrote:
> On 28.12.2019 01:42, Mr Flibble wrote:
>> On 27/12/2019 19:05, Alf P. Steinbach wrote:
>>> On 27.12.2019 17:38, Mr Flibble wrote:
>>>>
>>>> Egregious (std:: preferred).
>>>
>>> Why do you prefer to repeat a bit of text ad nauseam? It's more to
>>> write, more to read, recommended against by a number of generally
>>> accepted guidelines like DRY, and just plain freaking dumb. So, why?
>>
>> Taking your really bad analogy of DRY to its logical conclusion you
>> can only use a vector once in your entire program so you don't fucking
>> repeat yourself. Bad analogies are "just plain freaking dumb".
>
> I can agree with the last sentence.
>
> Regarding the rest, consider:
>
>
> #include <array>
>
> void leigh()
> {
> const int board_size = 8;
> std::array<std::array<int, board_size>, board_size> board =
> {
> std::array<int, board_size>{}, std::array<int, board_size>{},
> std::array<int, board_size>{}, std::array<int, board_size>{},
> std::array<int, board_size>{}, std::array<int, board_size>{},
> std::array<int, board_size>{}, std::array<int, board_size>{}
> };
> (void) board; // Whatever
> }
>
> void alf()
> {
> using std::array;
>
> const int width = 8;
> const int height = width;
>
> using Row = array<int, width>;
> using Board = array<Row, height>;
>
> Board board{};
> (void) board; // Whatever
> }
>
>
> Here the two functions manage to create a local variable called `board`,
> of the exact same type in the code as by your argumentation you would
> have written it, and in corresponding code by me.
>
> In the assumed-like-Leigh code the `std::` qualification and the type
> builder `array` is repeated ad nauseam, because you argue that even when
> it's known that all textual instances are a given text it should better
> be spelled out; and the focus, what's communicated to a reader, is on
> the details of the data representation and not on what it models.
>
> In the more DRY (Don't Repeat Yourself) Alf code the relevant namespace
> `std::` is mentioned only once; the type builder `array` is mentioned
> only in a `using` declaration and for the two types that it builds here,
> that is, three times; and the focus, what's communicated to a reader, is
> on what the structure models.
Alf, using deliberate exaggeration to try to invalidate a person's
argument is disingenuous at best but I am sure you know this.
void real_leigh()
{
std::size_t const width = 8;
std::size_t const height = width;
using row = std::array<int, width>;
using board = std::array<row, height>;
Board board{};
(void) board; // Whatever
}
Now please stop being a cunt.
/Flibble
--
“You won’t burn in hell. But be nice anyway.” – Ricky Gervais
“I see Atheists are fighting and killing each other again, over who
doesn’t believe in any God the most. Oh, no..wait.. that never happens.”
– Ricky Gervais
"Suppose it's all true, and you walk up to the pearly gates, and are
confronted by God," Bryne asked on his show The Meaning of Life. "What
will Stephen Fry say to him, her, or it?"
"I'd say, bone cancer in children? What's that about?" Fry replied.
"How dare you? How dare you create a world to which there is such misery
that is not our fault. It's not right, it's utterly, utterly evil."
"Why should I respect a capricious, mean-minded, stupid God who creates
a world that is so full of injustice and pain. That's what I would say."
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Two silly problems "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2019-12-26 16:47 +0100
Re: Two silly problems "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2019-12-26 16:51 +0100
Re: Two silly problems Bo Persson <bo@bo-persson.se> - 2019-12-26 16:55 +0100
Re: Two silly problems "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2019-12-27 05:07 +0100
Re: Two silly problems Mr Flibble <flibble@i42.removethisbit.co.uk> - 2019-12-27 16:38 +0000
Re: Two silly problems "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2019-12-27 20:05 +0100
Re: Two silly problems Mr Flibble <flibble@i42.removethisbit.co.uk> - 2019-12-28 00:42 +0000
Re: Two silly problems "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2019-12-28 07:37 +0100
Re: Two silly problems Mr Flibble <flibble@i42.removethisbit.co.uk> - 2019-12-28 15:51 +0000
Re: Two silly problems boltar@nowhere.org - 2019-12-28 16:30 +0000
Re: Two silly problems Mr Flibble <flibble@i42.removethisbit.co.uk> - 2019-12-28 17:15 +0000
csiph-web