Bug 17015 – support final switch in std.variant

Status
NEW
Severity
enhancement
Priority
P4
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2016-12-22T17:11:11Z
Last change time
2024-12-01T16:28:51Z
Assigned to
No Owner
Creator
Seb
Moved to GitHub: phobos#10221 →

Comments

Comment #0 by greeenify — 2016-12-22T17:11:11Z
As e.g. in https://github.com/s-ludwig/taggedalgebraic: final switch (taggedAny.kind) { case Tagged.Kind.i: // It's "int i" break; case Tagged.Kind.str: // It's "string str" break; case Tagged.Kind.foo: // It's "Foo foo" break; } this has the advantage over visit that the compiler can enforce that all types are covered.
Comment #1 by robert.schadek — 2024-12-01T16:28:51Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/10221 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB