Thread overview
alias for regular expressions
Sep 13, 2015
Thunderbird
Sep 13, 2015
anonymous
Sep 13, 2015
Thunderbird
Sep 14, 2015
Meta
Sep 15, 2015
Thunderbird
September 13, 2015
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?
September 13, 2015
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
September 13, 2015
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 :)
September 14, 2015
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));
September 15, 2015
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!