dst = src rather than src dst
Janice Caron
caron at serenityfirefly.com
Wed Sep 5 07:25:16 PDT 2007
-----Original Message-----
From: digitalmars-d-bounces at puremagic.com
[mailto:digitalmars-d-bounces at puremagic.com] On Behalf Of Jarrett Billingsley
Sent: 05 September 2007 14:43
To: digitalmars-d at puremagic.com
Subject: Re: dst = src rather than src dst
> I doubt this will ever change,
Mebbe. But there's no harm in asking!
> so to help you get used to the current syntax, <snip>
> Think of them like a variable declaration,
Sure, but alias is also used to importing symbols into the current namespace. A
good example in D 2.0+ would be
struct B
{
A super_A;
alias super_A this;
}
Here the intent is not to declare a variable, but to alias the symbol this.
Similarly
class Derived : Base
{
int f();
alias f f;
}
Which brings the implementations of f defined in Base into Derived. On a
similar note:
alias std.path.join join;
might be used to disambiguate between std.path.join and std.string.join. In all
of these cases, you are /not/ declaring a variable, you are pulling symbol
definitions into the current namespace, so your mneumonic doesn't work. I'm not
knocking it, mind. I'm just saying these would be more readable as (for
example)
alias join = std.path.join;
Or at least, I think so. Also, type expressions are now becoming more common,
and frankly
typedef Tx = typeof(x);
is self-explanatory. In any case, I wasn't necessarily suggesting that the old
syntax be scrapped, merely that new syntax be allowed.
More information about the Digitalmars-d
mailing list