www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - alias for regular expressions

reply Thunderbird <g10567520 trbvm.com> writes:
Some special interest thingamabob:

I've tried to redefine "else if" as "elif" using "alias elif = 
else if;". No matter what to no avail.

I know this is probably useless fancy stuff, but is there any way 
to get this done without much ado?
Sep 13 2015
parent reply anonymous <anonymous example.com> writes:
On Sunday 13 September 2015 21:47, Thunderbird wrote:

 Some special interest thingamabob:
 
 I've tried to redefine "else if" as "elif" using "alias elif = 
 else if;". No matter what to no avail.
 
 I know this is probably useless fancy stuff, but is there any way 
 to get this done without much ado?
no
Sep 13 2015
parent reply Thunderbird <g10567520 trbvm.com> writes:
On Sunday, 13 September 2015 at 19:51:38 UTC, anonymous wrote:
 On Sunday 13 September 2015 21:47, Thunderbird wrote:

 Some special interest thingamabob:
 
 I've tried to redefine "else if" as "elif" using "alias elif = 
 else if;". No matter what to no avail.
 
 I know this is probably useless fancy stuff, but is there any 
 way to get this done without much ado?
no
Thanks for your quick reply :)
Sep 13 2015
parent reply Meta <jared771 gmail.com> writes:
On Sunday, 13 September 2015 at 19:52:20 UTC, Thunderbird wrote:
 Thanks for your quick reply :)
To expand on that, alias in D is nothing like the C macro preprocessor. D specifically disallows tricks like `#define true false`. In D, aliases are just another name for a symbol. Ex: struct Test { int n; float f; } alias IntFloat = Test; //IntFloat is just another name for Test Test t = Test(0, 1.0); IntFloat inf = IntFloat(0, 1.0); //Test and IntFloat are NOT separate types. //Use std.typecons.Typedef for that assert(t == inf); assert(is(typeof(t) == typeof(inf));
Sep 14 2015
parent Thunderbird <g10662608 trbvm.com> writes:
On Monday, 14 September 2015 at 07:11:38 UTC, Meta wrote:
 On Sunday, 13 September 2015 at 19:52:20 UTC, Thunderbird wrote:
 Thanks for your quick reply :)
To expand on that, alias in D is nothing like the C macro preprocessor. D specifically disallows tricks like `#define true false`. In D, aliases are just another name for a symbol. Ex: struct Test { int n; float f; } alias IntFloat = Test; //IntFloat is just another name for Test Test t = Test(0, 1.0); IntFloat inf = IntFloat(0, 1.0); //Test and IntFloat are NOT separate types. //Use std.typecons.Typedef for that assert(t == inf); assert(is(typeof(t) == typeof(inf));
Thanks for elaborating!
Sep 15 2015