digitalmars.D - Just a thought...
- F i L (14/14) Apr 17 2012 Was just looking through some code and realized there's a lot of
- Gor Gyolchanyan (20/32) Apr 17 2012 What about:
- F i L (1/2) Apr 17 2012 Yes, I like this better.
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.
Apr 17 2012
What about:
enum isSomething(T) =3D is(...);
which would be referred to like this:
enum isIndeed =3D isSomething!T;
or
enum isSomething(T)
{
foo =3D is(...),
bar =3D is(...),
hat =3D is(...)
}
which would be referred to as:
enum isIndeed =3D 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:
=C2=A0template isSomething(T) {
=C2=A0 =C2=A0enum isSomething =3D is( ... );
=C2=A0}
I remember a discussion a little while ago about an alternative alias
syntax:
=C2=A0alias <name> =3D <type>;
Which I hope is still in the works, but I thought something similar _migh=
t_
be helpful for templates too. So the template above could be written:
=C2=A0template isSomething(T) =3D is( ... );
Which looks a bit cleaner.
Just a thought.
--=20
Bye,
Gor Gyolchanyan.
Apr 17 2012
enum isSomething(T) = is(...);Yes, I like this better.
Apr 17 2012








"F i L" <witte2008 gmail.com>