'typeof' not printing template arguments.

2017-07-11 Thread Deech via Digitalmars-d-learn
Hi all, I've been learning D for a few weeks by reading through Programming In D [1] and had a question about Eponymous Template section [2]. Here's the example: ``` template LargerOf(A, B) { static if (A.sizeof < B.sizeof) { alias LargerOf = B; } else { alias LargerOf = A; } }

Re: 'typeof' not printing template arguments.

2017-07-11 Thread Deech via Digitalmars-d-learn
On Wednesday, 12 July 2017 at 00:44:38 UTC, Deech wrote: Hi all, I've been learning D for a few weeks by reading through Programming In D [1] and had a question about Eponymous Template section [2]. Here's the example: ``` template LargerOf(A, B) { static if (A.sizeof < B.sizeof) { alia

Writing pattern matching macros in D.

2017-03-05 Thread Deech via Digitalmars-d-learn
Hi all, I've been reading up on D's metaprogramming features and was wondering if it was possible to use them to add pattern matching to the language as a macro. The template mixin feature seems to require putting the new syntax in strings. I was hoping there's an alternative. Thanks! -deech

Re: Writing pattern matching macros in D.

2017-03-06 Thread Deech via Digitalmars-d-learn
On Monday, 6 March 2017 at 08:27:13 UTC, David Nadlinger wrote: On Monday, 6 March 2017 at 02:20:02 UTC, Deech wrote: […] add pattern matching to the language as a macro. D doesn't have macros per se. However, template metaprogramming and mixins can replace them in many cases. Which particu