[Issue 16662] Can't call std.variant.visit from a pure function
https://issues.dlang.org/show_bug.cgi?id=16662 Iain Buclaw changed: What|Removed |Added Priority|P1 |P3 --
[Issue 16662] Can't call std.variant.visit from a pure function
https://issues.dlang.org/show_bug.cgi?id=16662 --- Comment #3 from Paul Backus--- I've made some progress on this, but am unable to make VariantN.peek pure, because this if statement if (type != typeid(T)) return null; ...calls object.opEquals, which is not pure. So issue #13933 needs to be fixed before we can solve this. --
[Issue 16662] Can't call std.variant.visit from a pure function
https://issues.dlang.org/show_bug.cgi?id=16662 --- Comment #2 from Илья Ярошенко--- Variant's "get" method is not pure too. It was a big surprise. No I need to figure out how to deal with it, the whole big project is pure. --
[Issue 16662] Can't call std.variant.visit from a pure function
https://issues.dlang.org/show_bug.cgi?id=16662 Илья Ярошенкоchanged: What|Removed |Added CC||ilyayaroshe...@gmail.com Severity|minor |normal --
[Issue 16662] Can't call std.variant.visit from a pure function
https://issues.dlang.org/show_bug.cgi?id=16662 --- Comment #1 from Paul Backus--- Seems like the culprit is VariantN.peek, which calls the property function "type", which calls (through "fptr") an instance of the internal template function "handler", which isn't pure. Almost all of VariantN's operations use "handler" internally, so making it pure would likely be difficult. On the other hand, modifying "fptr" to point to different instances of "handler" is how VariantN keeps track of the type of the stored object, so avoiding the use of "handler" would require substantial changes to VariantN's implementation. Here's the trail of breadcrumbs: --- // test.d import std.variant; alias Example = Algebraic!(int, double); void main() { Example x; pragma(msg, typeof(!int)); pragma(msg, typeof()); } --- $ dmd test.d inout(int)* delegate() inout @property @system TypeInfo delegate() const nothrow @property @trusted $ dmd --version DMD64 D Compiler v2.074.0 --
[Issue 16662] Can't call std.variant.visit from a pure function
https://issues.dlang.org/show_bug.cgi?id=16662 Andrei Alexandrescuchanged: What|Removed |Added Status|NEW |ASSIGNED --
[Issue 16662] Can't call std.variant.visit from a pure function
https://issues.dlang.org/show_bug.cgi?id=16662 Andrei Alexandrescuchanged: What|Removed |Added CC||and...@erdani.com Assignee|nob...@puremagic.com|alexandru.razva...@gmail.co ||m --