Date: Thu, 24 Apr 2025 22:11:02 -0400
Looking at var.txt, ou seem to be trying to reinvent std::variant, but instead of doing all the things one would want in a variant - reusing storage, tagging with a small value, you just have a struct that has one of each of the values you want, and “tags” the "active member” with a std::string.
Basically, you just want std::variant<std::string, char, bool, int, float, double>, or maybe a thin wrapper around this that has some extra functions that may or may not make sense based on which alternative is actually stored.
Also, not clear how this is a “universal type” that only stores values, not structures (presumably you mean something along the lines of built in primitive types) when you missed a bunch of actual primitive types (short, long, long long, long double, unsigned things, etc.) and included std::string, which is not a primitive type, but is in fact a class.
Perhaps if you gave the motivation for your proposal, it would be easier to guide you to the right types and usages.
Thanks,
Nate
> On Apr 24, 2025, at 8:10 PM, Paul Robert Stackhouse via Std-Proposals <std-proposals_at_[hidden]> wrote:
>
> Hello,
>
> I've just looked at the file for std::any, and it seems to operate differently than the classes that I've tried to create. The any does not seem to be able to accept string values, which my var and varDeque types can. My classes also can do so without the use of templates. The biggest downside, in addition to my varDeque class being incomplete, is that there are still a few bugs that I have to work out, mainly with the comparison (>, >=, etc) operators for the var class.
>
> Here are the files as I've created them. I converted them into txt files so that they can be safely sent to you.
>
> Despite not being template-based, they both store enough information in them to pass as variables. They store a double for the numerical value, and two strings for the text value and type value. The var type returns any value type, from string and char to bool, float, and double. It contains the operators for that. And once the varDeque is complete, it will be able to return any list or map of variables if one of those is what was stored inside them all along.
>
> Thank you for your responses.
>
> On Thu, Apr 24, 2025 at 7:31 PM Jeremy Rifkin <rifkin.jer_at_[hidden] <mailto:rifkin.jer_at_[hidden]>> wrote:
>> Hi,
>> I'm slightly confused about your description and how you envision this functionality working and what you're trying to achieve with it. As Jens pointed out, this sounds a lot like std::any. The reason you might not have heard of this or seen it used before is because it's of quite limited use in C++. Unlike dynamic languages such as Python, C++ has no language run-time that can handle dynamic types on the fly. Everything must be done statically. While types like std::any exist and can let you store any value, working with these can be quite cumbersome as you still have to explicitly handle every possible type you care about.
>>
>> > I know how to use the yvals_core.h file to make a custom std-namespace-based file
>>
>> I'm not quite sure what you mean by that but it sounds like something you probably shouldn't be doing. It sounds like a good way to get UB.
>>
>> Cheers,
>> Jeremy
>>
>> On Thu, Apr 24, 2025 at 5:24 PM Paul Robert Stackhouse via Std-Proposals <std-proposals_at_[hidden] <mailto:std-proposals_at_[hidden]>> wrote:
>>> Hello,
>>>
>>> I’m an up-and-coming programmer, who is making making their way through college. I am just about to complete an intro to C++ course. I have a few additions that I would like to propose. If needed, I can supply the code that I’ve worked on to make them a reality for myself.
>>>
>>> For some context, I know classes, templates, vectors, linked lists, recursion, etc. I know how to construct a variable from a class object and make it return different values by default, without using any class functions. I know about preprocessor directives, and I’ve seen some of the files for things like the iostream file, so I know how to use the yvals_core.h file to make a custom std-namespace-based file. That should provide you enough information to be able to see the capabilities of what I’ve made.
>>>
>>> As for what I’m recommending, it is a two-fold recommendation on making a universal variable type. The first is a universal value type. This can store any value inside itself and return any value stored in it to another variable. It is a universal value, since while it can store any individual value, it cannot store any structure of values. The other - and you’ll see how they are connected - is to make a universal storage type, that can store anything of any value inside itself. It would have to be able to store lists and vectors as well as maps, and it would have to be able to use only one set of storage for them. Additionally, as it would be a universal storage type, it would have to be able to store any individual values, like the universal value type. This would allow C++ to process complex and complicated documents with ease.
>>>
>>> Thank you for your consideration.
>>> paulrobert_at_[hidden] <mailto:paulrobert_at_[hidden]>
>>>
>>> P.S.
>>> If the sender address looks like it does not match the actual email name of paulrobert_at_[hidden] <mailto:paulrobert_at_[hidden]>, that is intentional. I use the paulrobert_at_[hidden] <mailto:paulrobert_at_[hidden]> name to create accounts, but any email sent to it gets redirected to the above email. I just thought I should let you know.
>>> --
>>> Std-Proposals mailing list
>>> Std-Proposals_at_[hidden] <mailto:Std-Proposals_at_[hidden]>
>>> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
> <var.txt><varDeque.txt>--
> Std-Proposals mailing list
> Std-Proposals_at_[hidden] <mailto:Std-Proposals_at_[hidden]>
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
Basically, you just want std::variant<std::string, char, bool, int, float, double>, or maybe a thin wrapper around this that has some extra functions that may or may not make sense based on which alternative is actually stored.
Also, not clear how this is a “universal type” that only stores values, not structures (presumably you mean something along the lines of built in primitive types) when you missed a bunch of actual primitive types (short, long, long long, long double, unsigned things, etc.) and included std::string, which is not a primitive type, but is in fact a class.
Perhaps if you gave the motivation for your proposal, it would be easier to guide you to the right types and usages.
Thanks,
Nate
> On Apr 24, 2025, at 8:10 PM, Paul Robert Stackhouse via Std-Proposals <std-proposals_at_[hidden]> wrote:
>
> Hello,
>
> I've just looked at the file for std::any, and it seems to operate differently than the classes that I've tried to create. The any does not seem to be able to accept string values, which my var and varDeque types can. My classes also can do so without the use of templates. The biggest downside, in addition to my varDeque class being incomplete, is that there are still a few bugs that I have to work out, mainly with the comparison (>, >=, etc) operators for the var class.
>
> Here are the files as I've created them. I converted them into txt files so that they can be safely sent to you.
>
> Despite not being template-based, they both store enough information in them to pass as variables. They store a double for the numerical value, and two strings for the text value and type value. The var type returns any value type, from string and char to bool, float, and double. It contains the operators for that. And once the varDeque is complete, it will be able to return any list or map of variables if one of those is what was stored inside them all along.
>
> Thank you for your responses.
>
> On Thu, Apr 24, 2025 at 7:31 PM Jeremy Rifkin <rifkin.jer_at_[hidden] <mailto:rifkin.jer_at_[hidden]>> wrote:
>> Hi,
>> I'm slightly confused about your description and how you envision this functionality working and what you're trying to achieve with it. As Jens pointed out, this sounds a lot like std::any. The reason you might not have heard of this or seen it used before is because it's of quite limited use in C++. Unlike dynamic languages such as Python, C++ has no language run-time that can handle dynamic types on the fly. Everything must be done statically. While types like std::any exist and can let you store any value, working with these can be quite cumbersome as you still have to explicitly handle every possible type you care about.
>>
>> > I know how to use the yvals_core.h file to make a custom std-namespace-based file
>>
>> I'm not quite sure what you mean by that but it sounds like something you probably shouldn't be doing. It sounds like a good way to get UB.
>>
>> Cheers,
>> Jeremy
>>
>> On Thu, Apr 24, 2025 at 5:24 PM Paul Robert Stackhouse via Std-Proposals <std-proposals_at_[hidden] <mailto:std-proposals_at_[hidden]>> wrote:
>>> Hello,
>>>
>>> I’m an up-and-coming programmer, who is making making their way through college. I am just about to complete an intro to C++ course. I have a few additions that I would like to propose. If needed, I can supply the code that I’ve worked on to make them a reality for myself.
>>>
>>> For some context, I know classes, templates, vectors, linked lists, recursion, etc. I know how to construct a variable from a class object and make it return different values by default, without using any class functions. I know about preprocessor directives, and I’ve seen some of the files for things like the iostream file, so I know how to use the yvals_core.h file to make a custom std-namespace-based file. That should provide you enough information to be able to see the capabilities of what I’ve made.
>>>
>>> As for what I’m recommending, it is a two-fold recommendation on making a universal variable type. The first is a universal value type. This can store any value inside itself and return any value stored in it to another variable. It is a universal value, since while it can store any individual value, it cannot store any structure of values. The other - and you’ll see how they are connected - is to make a universal storage type, that can store anything of any value inside itself. It would have to be able to store lists and vectors as well as maps, and it would have to be able to use only one set of storage for them. Additionally, as it would be a universal storage type, it would have to be able to store any individual values, like the universal value type. This would allow C++ to process complex and complicated documents with ease.
>>>
>>> Thank you for your consideration.
>>> paulrobert_at_[hidden] <mailto:paulrobert_at_[hidden]>
>>>
>>> P.S.
>>> If the sender address looks like it does not match the actual email name of paulrobert_at_[hidden] <mailto:paulrobert_at_[hidden]>, that is intentional. I use the paulrobert_at_[hidden] <mailto:paulrobert_at_[hidden]> name to create accounts, but any email sent to it gets redirected to the above email. I just thought I should let you know.
>>> --
>>> Std-Proposals mailing list
>>> Std-Proposals_at_[hidden] <mailto:Std-Proposals_at_[hidden]>
>>> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
> <var.txt><varDeque.txt>--
> Std-Proposals mailing list
> Std-Proposals_at_[hidden] <mailto:Std-Proposals_at_[hidden]>
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
Received on 2025-04-25 02:43:44