C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Function overload set type information loss

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Wed, 31 Jul 2024 21:39:07 -0400
On Wed, Jul 31, 2024 at 8:21 PM organicoman via Std-Proposals
<std-proposals_at_[hidden]> wrote:
> Of course we are. Yours is a proposal to change C++, so you need to explain
> how the new content will insert into the existing structure and not break
> anything that is already working. You must propose a delta to the current
> status.
>
> Ok, fair enough
> My proposal is trying to keep all information available about types, concerning only 3 categories of objects.
> -Arrays
> -Functions templates
> -Variable templates
> To achieve that we need a tool, in form of an operator, to record that lost information otherwise.
> This operator behaves exactly like its current counterparts so it will not break any existing code.
> But when used in some well defined manner it will trigger the compiler to do some type manipulation.

One of the big problems with this conversation is that you keep using
words wrong. You talk about "information available about types", but
the information you actually cite is *not part of the type*. The word
"type" in C++ has a very specific meaning, and none of the template
examples you've shown yourself querying is part of the type of those
constructs at all.

So allow me to attempt to translate this into something that might
actually be comprehensible relative to C++.

You want to store information alongside an object or variable (it's
unclear which, as I'm not sure you understand the difference between
those things) which is metadata about the nature of the expression
used to initialize it (note, not the "type" of that expression,
because the information you want is not part of its type). This
information should be stored in a way that is accessible at runtime,
but it must not take up any additional data storage. Furthermore, this
invisible information needs to follow that object/variable around,
through function calls, etc.

> "Pretend it works somehow" does not make sense. It has to work without
> pretending. And you have to explain how it will work, with detailed rules.
>
> Otherwise, we could have a pretend standard and a pretend compiler.
>
> I have detailed the greatest part of the necessary rules.
> I cannot find all the obscure corner cases in one sitting, otherwise i don't need to discuss it in threads.
>
> And pretending that something works is a logical way to find errors.
> 1- assume A is correct
> 2- Use it
> 3- if it give contradiction result, then your assumption is wrong
> 4- correct it
> 5- then repeat from 1.
>
> That's how usually we build softwares.

... so, you're saying that you program by assuming that something will
work, trying it, and deciding whether it works or not based on whether
you get the expected result (or the compiler says "no").

That explains so much about this entire conversation. Your misuse of
basic C++ terminology like "type", your misunderstanding of what
objects and variables are, your ignorance of what a template even is,
your confusion about how expressions work, etc.

You never really *learned* C++; you've gained "knowledge" by fiddling
around with it until you get something that works.

Received on 2024-08-01 01:39:20