| Thread overview | |||||
|---|---|---|---|---|---|
|
April 17, 2012 Just a thought... | ||||
|---|---|---|---|---|
| ||||
Was just looking through some code and realized there's a lot of this:
template isSomething(T) {
enum isSomething = is( ... );
}
I remember a discussion a little while ago about an alternative alias syntax:
alias <name> = <type>;
Which I hope is still in the works, but I thought something similar _might_ be helpful for templates too. So the template above could be written:
template isSomething(T) = is( ... );
Which looks a bit cleaner.
Just a thought.
| ||||
April 17, 2012 Re: Just a thought... | ||||
|---|---|---|---|---|
| ||||
Posted in reply to F i L | What about:
enum isSomething(T) = is(...);
which would be referred to like this:
enum isIndeed = isSomething!T;
or
enum isSomething(T)
{
foo = is(...),
bar = is(...),
hat = is(...)
}
which would be referred to as:
enum isIndeed = isSomething!(T).foo;
This would be the logical continuation of the numerous existing template shortcuts.
On Tue, Apr 17, 2012 at 7:41 PM, F i L <witte2008@gmail.com> wrote:
> Was just looking through some code and realized there's a lot of this:
>
> template isSomething(T) {
> enum isSomething = is( ... );
> }
>
> I remember a discussion a little while ago about an alternative alias syntax:
>
> alias <name> = <type>;
>
> Which I hope is still in the works, but I thought something similar _might_ be helpful for templates too. So the template above could be written:
>
> template isSomething(T) = is( ... );
>
> Which looks a bit cleaner.
>
>
> Just a thought.
--
Bye,
Gor Gyolchanyan.
| |||
April 17, 2012 Re: Just a thought... | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Gor Gyolchanyan | > enum isSomething(T) = is(...);
Yes, I like this better.
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply