On Wednesday, 22 April 2015 at 04:54:39 UTC, Martin Nowak wrote:
On Tuesday, 21 April 2015 at 15:36:28 UTC, Jadbox wrote:
What's the best equivalent to Rust's structural enum/pattern
(match)ing? Is it also possible to enforce exhaustive matches?
Basically, I'm curious on what the best way to do
On Tuesday, 21 April 2015 at 15:36:28 UTC, Jadbox wrote:
What's the best equivalent to Rust's structural enum/pattern
(match)ing? Is it also possible to enforce exhaustive matches?
Basically, I'm curious on what the best way to do ADTs in D.
If it needs to be really fast, use final switch on t
On 2015-04-21 17:36, Jadbox wrote:
What's the best equivalent to Rust's structural enum/pattern (match)ing?
Is it also possible to enforce exhaustive matches? Basically, I'm
curious on what the best way to do ADTs in D.
There's something call "castSwitch" [1], perhaps not what you're looking
f
On Tuesday, 21 April 2015 at 15:36:28 UTC, Jadbox wrote:
What's the best equivalent to Rust's structural enum/pattern
(match)ing? Is it also possible to enforce exhaustive matches?
Basically, I'm curious on what the best way to do ADTs in D.
D's ADTs are in std.variant, the equivalent of match
On Tue, 21 Apr 2015 15:36:27 +, Jadbox wrote:
> What's the best equivalent to Rust's structural enum/pattern (match)ing?
> Is it also possible to enforce exhaustive matches?
> Basically, I'm curious on what the best way to do ADTs in D.
std.variant.Algebraic implements ADTs:
import std.varia
Jadbox:
I'm curious on what the best way to do ADTs in D.
Sometimes there's no best way, there are several alternative ways
with different tradeoffs. D isn't a functional language and
there's no really good way to do ADTs in D. You can use plus a
"final switch". Or you can use Algebraic fro
What's the best equivalent to Rust's structural enum/pattern
(match)ing? Is it also possible to enforce exhaustive matches?
Basically, I'm curious on what the best way to do ADTs in D.