www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Just a thought...

reply "F i L" <witte2008 gmail.com> writes:
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
next sibling parent Gor Gyolchanyan <gor.f.gyolchanyan gmail.com> writes:
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=

 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
prev sibling parent "F i L" <witte2008 gmail.com> writes:
 enum isSomething(T) = is(...);

Yes, I like this better.
Apr 17 2012