October 16, 2012 Re: alias A = B; syntax | ||||
---|---|---|---|---|
| ||||
Posted in reply to kenji hara | On Tuesday, 16 October 2012 at 17:05:14 UTC, kenji hara wrote:
> The result of my challenging.
> https://github.com/D-Programming-Language/dmd/pull/1187
>
> Kenji Hara
As far as i remember, Andrei said that it was planned and the syntax will support templates too (like C++0x template alias). So, this might not be enough.
Something like:
alias vec(T) = vector!(T, allocator);
|
October 16, 2012 Re: alias A = B; syntax | ||||
---|---|---|---|---|
| ||||
Posted in reply to kenji hara | On Tuesday, 16 October 2012 at 17:05:14 UTC, kenji hara wrote:
> The result of my challenging.
> https://github.com/D-Programming-Language/dmd/pull/1187
Respect.
|
October 16, 2012 Re: alias A = B; syntax | ||||
---|---|---|---|---|
| ||||
Posted in reply to Era Scarecrow | On Tue, 16 Oct 2012 18:32:01 +0200
"Era Scarecrow" <rtcvb32@yahoo.com> wrote:
>
> alias SomeChar = char;
> alias SomeShort = short;
> alias SomeInt = int;
> alias SomeUInt = uint;
> alias SomeLong = long;
> alias SomeFloat = float;
> alias SomeDouble = double;
> uint MaybeBroken = nutmeg;
> const SomeChar FavoriateLanguage = 'D';
> const SomeShort universeAndEverything = 42;
> const SomeInt hundredThousand = 100_000;
> const SomeUInt million = SomeInt * 10;
> const SomeLong largeNumber = SomeUInt * SomeUInt;
> const SomeFloat pi = 3.14;
> const SomeDouble pi2 = pi*pi;
> const MaybeBroken maybe= 2;
>
Actually, that's the reason I've always preferred the idea of "alias NewSym = OldSym;"
Well, that and because with the current syntax I always have to stop and think "Ok, was it 'New then Old' or 'Old then New'?" I do know it's "alias OldSym NewSym;", but I always have to stop and think about it first. I even had to stop and think about it writing that sentence!
|
October 16, 2012 Re: alias A = B; syntax | ||||
---|---|---|---|---|
| ||||
Posted in reply to so | On Tue, 16 Oct 2012 20:45:34 +0200 "so" <so@so.so> wrote: > On Tuesday, 16 October 2012 at 17:05:14 UTC, kenji hara wrote: > > > The result of my challenging. https://github.com/D-Programming-Language/dmd/pull/1187 > > > > Kenji Hara > > As far as i remember, Andrei said that it was planned and the syntax will support templates too (like C++0x template alias). So, this might not be enough. > > Something like: > alias vec(T) = vector!(T, allocator); I think we can save that as a separate enhancement, especially since Walter has said he wants to do the same thing for variables, too (or at least enum manifest constants, anyway): http://forum.dlang.org/thread/jojish$2cm2$1@digitalmars.com?page=7#post-jok8e6:24k13:241:40digitalmars.com |
October 16, 2012 Re: alias A = B; syntax | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky | On Tuesday, 16 October 2012 at 21:30:27 UTC, Nick Sabalausky wrote:
> Well, that and because with the current syntax I always have to stop and think "Ok, was it 'New then Old' or 'Old then New'?"
I often have to read it to myself in a sentence, like, literally saying to myself: "alias old as new" to get it right.
|
October 17, 2012 Re: alias A = B; syntax | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | On 10/16/12 1:08 AM, Andrej Mitrovic wrote: > On 10/16/12, Jonathan M Davis<jmdavisProg@gmx.com> wrote: >> We'd have to dig through the newsgroup archives > > Nah just ask Andrei he already confirmed this once. And I confirm again. https://github.com/D-Programming-Language/dmd/pull/1187#issuecomment-9526522 Andrei |
October 17, 2012 Re: alias A = B; syntax | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | I would generally be pretty 'meh' on an enhancement like this, if not for the umpteen times I've aliased rather complex (read: long) types/template-instances and found myself thinking it would be nice for the new name to be at the (visually grep'able) beginning of the declaration. Consider simple example: alias pipe!( readText, splitLines, map!( e => e.splitter( ',' ) ), array ) readRows; alias readRows = pipe!( readText, splitLines, map!( e => e.splitter( ',' ) ), array ); So ultimately I'm happy to see the change, even if it isn't high on the priority list imho. -- Chris Nicholson-Sauls |
Copyright © 1999-2021 by the D Language Foundation