Skip to content

Commit

Permalink
Merge pull request #493 from JinShil/master
Browse files Browse the repository at this point in the history
changed 'alias y x' to 'alias x = y' throughout dlang.org
  • Loading branch information
9rnsr committed Feb 8, 2014
2 parents 0cc0cb5 + d1dd79c commit 13c6c45
Show file tree
Hide file tree
Showing 19 changed files with 134 additions and 133 deletions.
4 changes: 2 additions & 2 deletions attribute.dd
Expand Up @@ -649,14 +649,14 @@ pragma(msg, __traits(getAttributes, s)); // prints tuple('c')
---
template Tuple (T...)
{
alias T Tuple;
alias Tuple = T;
}

enum EEE = 7;
@("hello") struct SSS { }
@(3) { @(4) @EEE @SSS int foo; }

alias Tuple!(__traits(getAttributes, foo)) TP;
alias TP = Tuple!(__traits(getAttributes, foo));

pragma(msg, TP); // prints tuple(3, 4, 7, (SSS))
pragma(msg, TP[2]); // prints 7
Expand Down
4 changes: 2 additions & 2 deletions cpp0x.dd
Expand Up @@ -121,8 +121,8 @@ $(SECTION3 $(LNAME2 template-aliases, Template aliases for C++),
)
---
struct S(T) { T int; }
alias S X; // alias template
alias S!(int) Y; // alias template instantiation
alias X = S; // alias template
alias Y = S!(int); // alias template instantiation
X!(int) x;
Y y; // x and y are the same type
---
Expand Down
10 changes: 5 additions & 5 deletions cpptod.dd
Expand Up @@ -395,7 +395,7 @@ int x;

/** Another module **/
import foo;
alias foo.x x;
alias x = foo.x;
------

Alias is a much more flexible than the single purpose using
Expand Down Expand Up @@ -703,13 +703,13 @@ import std.stdio;
template Integer(int nbits)
{
static if (nbits <= 8)
alias byte Integer;
alias Integer = byte;
else static if (nbits <= 16)
alias short Integer;
alias Integer = short;
else static if (nbits <= 32)
alias int Integer;
alias Integer = int;
else static if (nbits <= 64)
alias long Integer;
alias Integer = long;
else
static assert(0);
}
Expand Down
8 changes: 4 additions & 4 deletions dstyle.dd
Expand Up @@ -69,7 +69,7 @@ struct FooAndBar;
to functions.

-------------------------
template GetSomeType(T) { alias T GetSomeType; }
template GetSomeType(T) { alias GetSomeType = T; }
template isSomeType(T) { enum isSomeType = is(T == SomeType); }
-------------------------
)
Expand Down Expand Up @@ -135,9 +135,9 @@ $(H3 Meaningless Type Aliases)
$(P Things like:)

-------------------------------
alias void VOID;
alias int INT;
alias int* pint;
alias VOID = void;
alias INT = int;
alias pint = int*;
-------------------------------

$(P should be avoided.)
Expand Down
28 changes: 14 additions & 14 deletions expression.dd
Expand Up @@ -1679,7 +1679,7 @@ void foo() {
$(I TypeSpecialization) is only allowed to be a $(I Type).

-------------
alias short bar;
alias bar = short;
void foo(bar x) {
if ( is(bar : int) ) // satisfied because short can be
// implicitly converted to int
Expand Down Expand Up @@ -1709,7 +1709,7 @@ void foo(bar x) {
then the condition is satisfied if $(I Type) is one of those.

-------------
alias short bar;
alias bar = short;

void test(bar x) {
if ( is(bar == int) ) // not satisfied because short is not
Expand All @@ -1727,12 +1727,12 @@ void test(bar x) {
is declared to be an alias of $(I Type).

-------------
alias short bar;
alias bar = short;
void foo(bar x) {
static if ( is(bar T) )
alias T S;
alias S = T;
else
alias long S;
alias S = long;

writeln(typeid(S)); // prints "short"
if ( is(bar T) ) // error, Identifier T form can
Expand All @@ -1755,13 +1755,13 @@ void foo(bar x) {
)

-------------
alias int bar;
alias long* abc;
alias bar = int;
alias abc = long*;
void foo(bar x, abc a) {
static if ( is(bar T : int) )
alias T S;
alias S = T;
else
alias long S;
alias S = long;

writeln(typeid(S)); // prints "int"

Expand Down Expand Up @@ -1835,12 +1835,12 @@ void foo(bar x, abc a) {
)

-------------
alias short bar;
alias bar = short;
enum E : byte { Emember }
void foo(bar x) {
static if ( is(bar T == int) ) // not satisfied, short is not int
alias T S;
alias T U; // error, T is not defined
alias S = T;
alias U = T; // error, T is not defined

static if ( is(E V == enum) ) // satisified, E is an enum
V v; // v is declared to be a byte
Expand All @@ -1865,8 +1865,8 @@ void foo(bar x) {
import std.stdio, std.typecons;

void main() {
alias Tuple!(int, string) Tup;
alias long[char[]] AA;
alias Tup = Tuple!(int, string);
alias AA = long[char[]];

static if (is(Tup : TX!TL, alias TX, TL...))
{
Expand Down
6 changes: 3 additions & 3 deletions function.dd
Expand Up @@ -521,7 +521,7 @@ class A {
}

class B : A {
$(CODE_HIGHLIGHT alias A.foo foo;)
$(CODE_HIGHLIGHT alias foo = A.foo;)
override int foo(long x) { ... }
}

Expand Down Expand Up @@ -766,8 +766,8 @@ void bar(C c) {
import A;
import B;

alias A.foo foo;
alias B.foo foo;
alias foo = A.foo;
alias foo = B.foo;

void bar(C c) {
foo(); // calls A.foo()
Expand Down
4 changes: 2 additions & 2 deletions hijack.dd
Expand Up @@ -201,8 +201,8 @@ $(P If overloading of $(CODE foo) between X and Y is desired, the following can
import X;
import Y;

alias X.foo foo;
alias Y.foo foo;
alias foo = X.foo;
alias foo = Y.foo;

void abc()
{
Expand Down
2 changes: 1 addition & 1 deletion htod.dd
Expand Up @@ -120,7 +120,7 @@ extern (C):
uint u;
//C #define MYINT int
//C void bar(int x, long y, long long z);
alias int MYINT;
alias MYINT = int;
void bar(int x, int y, long z);
---

Expand Down
5 changes: 3 additions & 2 deletions htomodule.dd
Expand Up @@ -279,7 +279,7 @@ typedef int foo;
becomes:

---------------------------
alias int foo;
alias foo = int;
---------------------------

$(H4 Structs)
Expand All @@ -300,7 +300,8 @@ struct Foo
{ int a;
int b;
}
alias Foo* pFoo, lpFoo;
alias pFoo = Foo*;
alias lpFoo = Foo*;
---------------------------

$(H4 Struct Member Alignment)
Expand Down
4 changes: 2 additions & 2 deletions interfaceToC.dd
Expand Up @@ -291,7 +291,7 @@ extern "C" Callback getCallback(void)
)

---
alias extern(C) int function(int, int) Callback; // D code
extern(C) alias Callback = int function(int, int); // D code
extern(C) Callback getCallback();
void main()
{
Expand All @@ -310,7 +310,7 @@ extern "C" void printer(int (*callback)(int, int)) // C code
)

---
alias extern(C) int function(int, int) Callback; // D code
extern(C) alias Callback = int function(int, int); // D code
extern(C) void printer(Callback callback);
extern(C) int sum(int x, int y) { return x + y; }
void main()
Expand Down
2 changes: 1 addition & 1 deletion module.dd
Expand Up @@ -246,7 +246,7 @@ void test()
module E;
import A;
import B;
alias B.foo foo;
alias foo = B.foo;
void test()
{
foo(); // call B.foo()
Expand Down
6 changes: 3 additions & 3 deletions pretod.dd
Expand Up @@ -254,7 +254,7 @@ $(CCODE
$(DWAY

---------
alias int INT;
alias INT = int;
---------
)
)
Expand Down Expand Up @@ -396,12 +396,12 @@ int getValueA(char *p);
version (UNICODE)
{
int getValueW(wchar[] p);
alias getValueW getValue;
alias getValue = getValueW;
}
else
{
int getValueA(char[] p);
alias getValueA getValue;
alias getValue = getValueA;
}
---------
)
Expand Down
6 changes: 3 additions & 3 deletions statement.dd
Expand Up @@ -212,7 +212,7 @@ $(GNAME DeclarationStatement):
----
int a; // declare a as type int and initialize it to 0
struct S { } // declare struct s
alias int myint;
alias myint = int;
----

$(H3 $(LNAME2 IfStatement, If Statement))
Expand Down Expand Up @@ -728,7 +728,7 @@ import std.stdio;
import std.typetuple; // for TypeTuple

void main() {
alias TypeTuple!(int, long, double) TL;
alias TL = TypeTuple!(int, long, double);

foreach (T; TL)
{
Expand Down Expand Up @@ -1267,7 +1267,7 @@ with (expression)

--------------
struct Foo {
alias int Y;
alias Y = int;
}
...
Y y; // error, Y undefined
Expand Down
4 changes: 2 additions & 2 deletions template-comparison.dd
Expand Up @@ -112,7 +112,7 @@ template Foo(T)
class Foo(T, U) { }
template MyFoo(T)
{
alias Foo!(T, int) MyFoo;
alias MyFoo = Foo!(T, int);
}
MyFoo!(uint) f;
---
Expand Down Expand Up @@ -640,7 +640,7 @@ class Foo(T)
}

struct Bar(T1, T2) { }
alias Bar!(int, float) BarInst;
alias BarInst = Bar!(int, float);
Foo!(BarInst) f;
---
See $(LINK2 expression.html#IsExpression, is expressions).
Expand Down

0 comments on commit 13c6c45

Please sign in to comment.