2 ms·
D allows the () to be skipped for one template argument: X!(T) X!T are the same. This was Andrei's idea, and it worked out nicely.
by WalterBright 4y ago
D allows the () to be skipped for one template argument:
X!(T)
X!T
are the same. This was Andrei's idea, and it worked out nicely.
- ben0x539 4y agoYeah, I think that's very cool and reads nicely in a lot of cases. D is definitely always a language that comes to mind thinking about "has lots of important features" + "doesn't look crufty".
- WalterBright 4y agoThe way the code looks was always a high priority for D. I suppose that dates back to my aviation experience, where if an airplane is beautiful it very likely flies well, too.
- ssokolow 4y agoThat was proposed and rejected for Rust recently: https://github.com/rust-lang/rfcs/pull/3267 https://github.com/rust-lang/rfcs/pull/3267 I was against because I felt that there should always be parens/brackets/braces (macros can use any of them) for better scannability when you're invoking an unclear amount of extra stuff behind the scenes. (An appeal to the "make costs explicit" side of Rust's philosophy that also requires explicit .clone() rather than copy constructors.) Here's the summary of why the consensus was "no": https://github.com/rust-lang/rfcs/pull/3267#issuecomment-1282943902 https://github.com/rust-lang/rfcs/pull/3267#issuecomment-128...