digitalmars.D.learn - std.variant and const
- Lutger (7/7) Aug 07 2010 Variant in phobos doesn't work well with being const, toHash and opEqual...
- Jonathan M Davis (9/17) Aug 07 2010 The fact that Object is not const-correct is a huge problem.
- Lutger (2/23) Aug 07 2010 Ouch. Thanks for the intel.
Variant in phobos doesn't work well with being const, toHash and opEquals for example are not marked as const methods. I have tried to work around it with careful casting, but it is too unsafe and just too complex for something that is supposed to make life easier. Does anybody know if this is a temporary problem with variant itself or related to other bugs or limitations? Should I file a bug report for this? I could only find this: http://d.puremagic.com/issues/show_bug.cgi?id=3795
Aug 07 2010
On Saturday 07 August 2010 05:42:53 Lutger wrote:Variant in phobos doesn't work well with being const, toHash and opEquals for example are not marked as const methods. I have tried to work around it with careful casting, but it is too unsafe and just too complex for something that is supposed to make life easier. Does anybody know if this is a temporary problem with variant itself or related to other bugs or limitations? Should I file a bug report for this? I could only find this: http://d.puremagic.com/issues/show_bug.cgi?id=3795The fact that Object is not const-correct is a huge problem. http://d.puremagic.com/issues/show_bug.cgi?id=1824 covers that, but I don't know when it's going to be fixed. http://d.puremagic.com/issues/show_bug.cgi?id=3748 which deals with inout probably has to be fixed first. So, I don't know whether there's really an issue with Variant itself, but the fact that functions like toHash() opEquals() aren't const is a big problem which is supposed to be addressed at some point but hasn't yet. - Jonathan M Davis
Aug 07 2010
Jonathan M Davis wrote:On Saturday 07 August 2010 05:42:53 Lutger wrote:Ouch. Thanks for the intel.Variant in phobos doesn't work well with being const, toHash and opEquals for example are not marked as const methods. I have tried to work around it with careful casting, but it is too unsafe and just too complex for something that is supposed to make life easier. Does anybody know if this is a temporary problem with variant itself or related to other bugs or limitations? Should I file a bug report for this? I could only find this: http://d.puremagic.com/issues/show_bug.cgi?id=3795The fact that Object is not const-correct is a huge problem. http://d.puremagic.com/issues/show_bug.cgi?id=1824 covers that, but I don't know when it's going to be fixed. http://d.puremagic.com/issues/show_bug.cgi?id=3748 which deals with inout probably has to be fixed first. So, I don't know whether there's really an issue with Variant itself, but the fact that functions like toHash() opEquals() aren't const is a big problem which is supposed to be addressed at some point but hasn't yet. - Jonathan M Davis
Aug 07 2010