Macros and operation of pattern matching `=>` in Rust I can write something like this:

macro_rules!foo {
    (x => $e:expr) => (println!("mode X: {}", $e));
    (y => $e:expr) => (println!("mode Y: {}", $e));
}

fn main() {
    foo!(y => 3); // mode Y: 3
    foo!(x => 2); // mode X: 2
}

How is it possible to simulate in D?

Reply via email to