Re: alias for regular expressions

2015-09-15 Thread Thunderbird via Digitalmars-d-learn

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!


Re: alias for regular expressions

2015-09-14 Thread Meta via Digitalmars-d-learn

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));


Re: alias for regular expressions

2015-09-13 Thread Thunderbird via Digitalmars-d-learn

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 :)


Re: alias for regular expressions

2015-09-13 Thread anonymous via Digitalmars-d-learn
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


alias for regular expressions

2015-09-13 Thread Thunderbird via Digitalmars-d-learn

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?