On Thursday, 17 May 2018 at 08:37:01 UTC, Heromyth wrote:
On Monday, 19 September 2016 at 22:59:53 UTC, Jonathan Marler
wrote:
On Monday, 19 September 2016 at 22:17:34 UTC, Mathias Lang
wrote:
[...]
Good example, thanks for the information.
Maybe the compiler can do more works to make the code more
readable. Here are my examples:
template EventHandler(T=Object)
{
alias EventHandler = void delegate(T sender);
}
void test01(EventHandler handler) // Error
{
// It's what I want. However, it doesn't work.
}
void test02(EventHandler!() handler)
{
// It works. Howerve, it ...
}
void test03()(EventHandler handler)
{
// It works too. Howerve, it ...
}
void test04(EventHandler!string handler)
{
// It's OK.
}
If you want, take a look at dtemplate.d in the compiler source. :)
I would advise to do this when well rested and motivated.