Changeset 1242

Show
Ignore:
Timestamp:
07/16/09 18:24:08 (3 years ago)
Author:
walter
Message:

latest

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/docsrc/attribute.dd

    r671 r1242  
    2121    $(LINK2 #auto, $(B auto)) 
    2222    $(LINK2 #scope, $(B scope)) 
     23$(V2    $(LINK2 #gshared, $(B __gshared)) 
     24    $(LINK2 #shared, $(B shared)) 
     25    $(LINK2 #immutable, $(B immutable)) 
     26 
     27) 
    2328 
    2429$(GNAME DeclarationBlock) 
     
    338343) 
    339344 
     345$(V2 
     346<h2>$(LNAME2 immutable, immutable Attribute)</h2> 
     347 
     348<h2>$(LNAME2 gshared, __gshared Attribute)</h2> 
     349 
     350<h2>$(LNAME2 shared, shared Attribute)</h2> 
     351) 
    340352 
    341353<h2>$(LNAME2 override, Override Attribute)</h2> 
  • trunk/docsrc/const3.dd

    r863 r1242  
    11Ddoc 
    22 
    3 $(D_S Const and Invariant
     3$(D_S Const and Immutable
    44 
    55    $(P When examining a data structure or interface, it is very 
     
    77    change, which data might change, and who may change that data. 
    88    This is done with the aid of the language typing system. 
    9     Data can be marked as const or invariant, with the default being 
     9    Data can be marked as const or immutable, with the default being 
    1010    changeable (or $(I mutable)). 
    1111    ) 
    1212 
    13     $(P $(I invariant) applies to data that cannot change. 
    14     Invariant data values, once constructed, remain the same for 
     13    $(P $(I immutable) applies to data that cannot change. 
     14    Immutable data values, once constructed, remain the same for 
    1515    the duration of the program's 
    1616    execution. 
    17     Invariant data can be placed in ROM (Read Only Memory) or in 
     17    Immutable data can be placed in ROM (Read Only Memory) or in 
    1818    memory pages marked by the hardware as read only. 
    19     Since invariant data does not change, it enables many opportunities 
     19    Since immutable data does not change, it enables many opportunities 
    2020    for program optimization, and has applications in functional 
    2121    style programming. 
     
    2929    ) 
    3030 
    31     $(P Both invariant and const are $(I transitive), which means 
    32     that any data reachable through an invariant reference is also 
    33     invariant, and likewise for const. 
    34     ) 
    35  
    36 $(SECTION2 Invariant Storage Class, 
    37  
    38     $(P 
    39     The simplest invariant declarations use it as a storage class. 
     31    $(P Both immutable and const are $(I transitive), which means 
     32    that any data reachable through an immutable reference is also 
     33    immutable, and likewise for const. 
     34    ) 
     35 
     36$(SECTION2 Immutable Storage Class, 
     37 
     38    $(P 
     39    The simplest immutable declarations use it as a storage class. 
    4040    It can be used to declare manifest constants. 
    4141    ) 
    4242 
    4343--- 
    44 invariant int x = 3;  // x is set to 3 
    45 x = 4;          // error, x is invariant 
     44immutable int x = 3;  // x is set to 3 
     45x = 4;          // error, x is immutable 
    4646char[x] s;      // s is an array of 3 char's 
    4747--- 
     
    5050    ) 
    5151--- 
    52 invariant y = 4;  // y is of type int 
    53 y = 5;          // error, y is invariant 
    54 --- 
    55  
    56     $(P If the initializer is not present, the invariant can 
     52immutable y = 4;  // y is of type int 
     53y = 5;          // error, y is immutable 
     54--- 
     55 
     56    $(P If the initializer is not present, the immutable can 
    5757    be initialized from the corresponding constructor: 
    5858    ) 
    5959 
    6060--- 
    61 invariant int z; 
     61immutable int z; 
    6262void test() 
    6363{ 
    64     z = 3;      // error, z is invariant 
     64    z = 3;      // error, z is immutable 
    6565} 
    6666static this() 
    6767{ 
    68     z = 3;    // ok, can set invariant that doesn't have 
     68    z = 3;    // ok, can set immutable that doesn't have 
    6969              // static initializer 
    7070} 
    7171--- 
    7272    $(P 
    73     The initializer for a non-local invariant declaration must be 
     73    The initializer for a non-local immutable declaration must be 
    7474    evaluatable 
    7575    at compile time: 
     
    7979int foo(int f) { return f * 3; } 
    8080int i = 5; 
    81 invariant x = 3 * 4;      // ok, 12 
    82 invariant y = i + 1;      // error, cannot evaluate at compile time 
    83 invariant z = foo(2) + 1; // ok, foo(2) can be evaluated at compile time, 7 
    84 --- 
    85  
    86     $(P The initializer for a non-static local invariant declaration 
     81immutable x = 3 * 4;      // ok, 12 
     82immutable y = i + 1;      // error, cannot evaluate at compile time 
     83immutable z = foo(2) + 1; // ok, foo(2) can be evaluated at compile time, 7 
     84--- 
     85 
     86    $(P The initializer for a non-static local immutable declaration 
    8787    is evaluated at run time: 
    8888    ) 
     
    9090int foo(int f) 
    9191{ 
    92   invariant x = f + 1;  // evaluated at run time 
    93   x = 3;                // error, x is invariant 
    94 } 
    95 --- 
    96  
    97     $(P 
    98     Because invariant is transitive, data referred to by an invariant is 
    99     also invariant
    100     ) 
    101  
    102 --- 
    103 invariant char[] s = "foo"; 
    104 s[0] = 'a';  // error, s refers to invariant data 
    105 s = "bar";   // error, s is invariant 
    106 --- 
    107  
    108     $(P Invariant declarations can appear as lvalues, i.e. they can 
     92  immutable x = f + 1;  // evaluated at run time 
     93  x = 3;                // error, x is immutable 
     94} 
     95--- 
     96 
     97    $(P 
     98    Because immutable is transitive, data referred to by an immutable is 
     99    also immutable
     100    ) 
     101 
     102--- 
     103immutable char[] s = "foo"; 
     104s[0] = 'a';  // error, s refers to immutable data 
     105s = "bar";   // error, s is immutable 
     106--- 
     107 
     108    $(P Immutable declarations can appear as lvalues, i.e. they can 
    109109    have their address taken, and occupy storage. 
    110110    ) 
     
    114114 
    115115    $(P 
    116     A const declaration is exactly like an invariant declaration, 
     116    A const declaration is exactly like an immutable declaration, 
    117117    with the following differences: 
    118118    ) 
     
    180180$(TABLE1 
    181181<caption>Template Argument Deduced Type</caption> 
    182 $(TR $(TH &nbsp;)               $(TH mutable $(CODE T)) $(TH1 const(T)) $(TH1 invariant(T))) 
     182$(TR $(TH &nbsp;)               $(TH mutable $(CODE T)) $(TH1 const(T)) $(TH1 immutable(T))) 
    183183$(TR $(TD1 foo(U))              $(TDE T) $(TDE T) $(TDE T)) 
    184 $(TR $(TD1 foo(U:U))            $(TDE T) $(TDE const(T)) $(TDE invariant(T))) 
     184$(TR $(TD1 foo(U:U))            $(TDE T) $(TDE const(T)) $(TDE immutable(T))) 
    185185$(TR $(TD1 foo(U:const(U)))     $(TDI T) $(TDE T) $(TDI T)) 
    186 $(TR $(TD1 foo(U:invariant(U))) $(NM) $(NM) $(TDE T)) 
     186$(TR $(TD1 foo(U:immutable(U))) $(NM) $(NM) $(TDE T)) 
    187187) 
    188188 
     
    196196) 
    197197 
    198 $(SECTION2 Invariant Type, 
    199  
    200     $(P 
    201     Data that will never change its value can be typed as invariant
    202     The invariant keyword can be used as a $(I type constructor): 
    203     ) 
    204  
    205 --- 
    206 invariant(char)[] s = "hello"; 
    207 --- 
    208  
    209     $(P 
    210     The invariant applies to the type within the following parentheses. 
     198$(SECTION2 Immutable Type, 
     199 
     200    $(P 
     201    Data that will never change its value can be typed as immutable
     202    The immutable keyword can be used as a $(I type constructor): 
     203    ) 
     204 
     205--- 
     206immutable(char)[] s = "hello"; 
     207--- 
     208 
     209    $(P 
     210    The immutable applies to the type within the following parentheses. 
    211211    So, while $(CODE s) can be assigned new values, 
    212212    the contents of $(CODE s[]) cannot be: 
     
    214214 
    215215--- 
    216 s[0] = 'b';  // error, s[] is invariant 
    217 s = null;    // ok, s itself is not invariant 
    218 --- 
    219  
    220     $(P 
    221     Invariantness is transitive, meaning it applies to anything that 
    222     can be referenced from the invariant type: 
    223     ) 
    224  
    225 --- 
    226 invariant(char*)** p = ...; 
    227 p = ...;        // ok, p is not invariant 
    228 *p = ...;       // ok, *p is not invariant 
    229 **p = ...;      // error, **p is invariant 
    230 ***p = ...;     // error, ***p is invariant 
    231 --- 
    232  
    233     $(P Invariant used as a storage class is equivalent to using 
    234     invariant as a type constructor for the entire type of a 
     216s[0] = 'b';  // error, s[] is immutable 
     217s = null;    // ok, s itself is not immutable 
     218--- 
     219 
     220    $(P 
     221    Immutableness is transitive, meaning it applies to anything that 
     222    can be referenced from the immutable type: 
     223    ) 
     224 
     225--- 
     226immutable(char*)** p = ...; 
     227p = ...;        // ok, p is not immutable 
     228*p = ...;       // ok, *p is not immutable 
     229**p = ...;      // error, **p is immutable 
     230***p = ...;     // error, ***p is immutable 
     231--- 
     232 
     233    $(P Immutable used as a storage class is equivalent to using 
     234    immutable as a type constructor for the entire type of a 
    235235    declaration:) 
    236236 
    237237--- 
    238 invariant int x = 3;   // x is typed as invariant(int) 
    239 invariant(int) y = 3;  // y is invariant 
    240 --- 
    241 ) 
    242  
    243  
    244 $(SECTION2 Creating Invariant Data, 
    245  
    246     $(P 
    247     The first way is to use a literal that is already invariant
    248     such as string literals. String literals are always invariant
    249     ) 
    250  
    251 --- 
    252 auto s = "hello";   // s is invariant(char)[5] 
    253 char[] p = "world"; // error, cannot implicitly convert invariant 
     238immutable int x = 3;   // x is typed as immutable(int) 
     239immutable(int) y = 3;  // y is immutable 
     240--- 
     241) 
     242 
     243 
     244$(SECTION2 Creating Immutable Data, 
     245 
     246    $(P 
     247    The first way is to use a literal that is already immutable
     248    such as string literals. String literals are always immutable
     249    ) 
     250 
     251--- 
     252auto s = "hello";   // s is immutable(char)[5] 
     253char[] p = "world"; // error, cannot implicitly convert immutable 
    254254            // to mutable 
    255255--- 
    256256 
    257257    $(P 
    258     The second way is to cast data to invariant
     258    The second way is to cast data to immutable
    259259    When doing so, it is up to the programmer to ensure that no 
    260260    other mutable references to the same data exist. 
     
    263263--- 
    264264char[] s = ...; 
    265 invariant(char)[] p = cast(invariant)s;     // undefined behavior 
    266 invariant(char)[] p = cast(invariant)s.dup; // ok, unique reference 
    267 --- 
    268  
    269     $(P 
    270     The $(CODE .idup) property is a convenient way to create an invariant 
     265immutable(char)[] p = cast(immutable)s;     // undefined behavior 
     266immutable(char)[] p = cast(immutable)s.dup; // ok, unique reference 
     267--- 
     268 
     269    $(P 
     270    The $(CODE .idup) property is a convenient way to create an immutable 
    271271    copy of an array: 
    272272    ) 
     
    274274--- 
    275275auto p = s.idup; 
    276 p[0] = ...;   // error, p[] is invariant 
    277 --- 
    278  
    279 <h2>Removing Invariant With A Cast</h2> 
    280  
    281     $(P 
    282     The invariant type can be removed with a cast: 
    283     ) 
    284  
    285 --- 
    286 invariant int* p = ...; 
     276p[0] = ...;   // error, p[] is immutable 
     277--- 
     278 
     279<h2>Removing Immutable With A Cast</h2> 
     280 
     281    $(P 
     282    The immutable type can be removed with a cast: 
     283    ) 
     284 
     285--- 
     286immutable int* p = ...; 
    287287int* q = cast(int*)p; 
    288288--- 
     
    297297 
    298298    $(P 
    299     The ability to cast away invariant-correctness is necessary in 
     299    The ability to cast away immutable-correctness is necessary in 
    300300    some cases where the static typing is incorrect and not fixable, such 
    301301    as when referencing code in a library one cannot change. 
    302302    Casting is, as always, a blunt and effective instrument, and 
    303     when using it to cast away invariant-correctness, one must assume 
    304     the responsibility to ensure the invariantness of the data, as 
     303    when using it to cast away immutable-correctness, one must assume 
     304    the responsibility to ensure the immutableness of the data, as 
    305305    the compiler will no longer be able to statically do so. 
    306306    ) 
     
    308308 
    309309 
    310 $(SECTION2 Invariant Member Functions, 
    311  
    312     $(P 
    313     Invariant member functions are guaranteed that the object 
    314     and anything referred to by the $(CODE this) reference is invariant
     310$(SECTION2 Immutable Member Functions, 
     311 
     312    $(P 
     313    Immutable member functions are guaranteed that the object 
     314    and anything referred to by the $(CODE this) reference is immutable
    315315    They are declared as: 
    316316    ) 
     
    320320{   int x; 
    321321 
    322     invariant void foo() 
     322    immutable void foo() 
    323323    { 
    324     x = 4;      // error, x is invariant 
    325     this.x = 4; // error, x is invariant 
     324    x = 4;      // error, x is immutable 
     325    this.x = 4; // error, x is immutable 
    326326    } 
    327327--- 
    328328 
    329     $(P The $(D_KEYWORD const) and $(D_KEYWORD invariant) function 
     329    $(P The $(D_KEYWORD const) and $(D_KEYWORD immutable) function 
    330330    attributes 
    331331    can also appear after the closing parenthesis of 
     
    336336struct S 
    337337{ 
    338     void bar() invariant 
     338    void bar() immutable 
    339339    { 
    340340    } 
     
    347347 
    348348    $(P 
    349     Const types are like invariant types, except that const 
     349    Const types are like immutable types, except that const 
    350350    forms a read-only $(I view) of data. Other aliases to that 
    351351    same data may change it at any time. 
     
    367367 
    368368    $(P 
    369     Mutable and invariant types can be implicitly converted to const. 
    370     Mutable types cannot be implicitly converted to invariant
     369    Mutable and immutable types can be implicitly converted to const. 
     370    Mutable types cannot be implicitly converted to immutable
    371371    and vice versa. 
    372372    ) 
     
    374374 
    375375 
    376 $(SECTION2 Comparing D Invariant and Const with C++ Const, 
     376$(SECTION2 Comparing D Immutable and Const with C++ Const, 
    377377 
    378378    <table border=2 cellpadding=4 cellspacing=0 class="comp"> 
    379     <caption>Const, Invariant Comparison</caption> 
     379    <caption>Const, Immutable Comparison</caption> 
    380380 
    381381    <thead> 
     
    396396 
    397397    $(TR 
    398     $(TD invariant keyword) 
     398    $(TD immutable keyword) 
    399399    $(TD Yes) 
    400400    $(TD No) 
     
    520520 
    521521    $(TR 
    522     $(TD aliasing of invariant with mutable) 
     522    $(TD aliasing of immutable with mutable) 
    523523    $(TD No: 
    524524--- 
    525 void foo(invariant int* x, int* y) 
     525void foo(immutable int* x, int* y) 
    526526{ 
    527527   bar(*x); // bar(3) 
     
    531531... 
    532532int i = 3; 
    533 foo(cast(invariant)&i, &i); 
    534 --- 
    535     ) 
    536     $(TD No invariants) 
     533foo(cast(immutable)&i, &i); 
     534--- 
     535    ) 
     536    $(TD No immutables) 
    537537    ) 
    538538 
    539539    $(TR 
    540540    $(TD type of string literal) 
    541     $(TD invariant(char)[]) 
     541    $(TD immutable(char)[]) 
    542542    $(TD const char*) 
    543543    ) 
     
    565565    Y=$(TD $(GREEN Yes)) 
    566566    N=$(TD $(RED No)) 
    567     TITLE=Const and Invariant 
     567    TITLE=Const and Immutable 
    568568    WIKI=ConstInvariant 
    569569    NO=<td class="compNo">No</td> 
     
    575575    ERROR = $(RED $(B error)) 
    576576    COMMA=, 
    577 META_KEYWORDS=D Programming Language, const, invariant 
     577META_KEYWORDS=D Programming Language, const, immutable 
    578578META_DESCRIPTION=Comparison of const between the 
    579579D programming language, C++, and C++0x 
  • trunk/docsrc/ctod.dd

    r850 r1242  
    4040    $(LI $(LINK2 #forwardfunc, Forward referencing functions)) 
    4141    $(LI $(LINK2 #funcvoid, Functions that have no arguments)) 
    42     $(LI $(LINK2 #labelledbreak, Labelled break and continue statements)) 
     42    $(LI $(LINK2 #labeledbreak, Labeled break and continue statements)) 
    4343    $(LI $(LINK2 #goto, Goto Statements)) 
    4444    $(LI $(LINK2 #tagspace, Struct tag name space)) 
     
    501501 
    502502<hr><!-- ============================================ --> 
    503 <h3><a name="labelledbreak">Labelled break and continue statements</a></h3> 
     503<h3><a name="labeledbreak">Labeled break and continue statements</a></h3> 
    504504 
    505505<h4>The C Way</h4> 
     
    558558 
    559559       Many C-way goto statements can be eliminated with the D feature of 
    560        labelled  
     560       labeled  
    561561       break and continue statements. But D is a practical language for 
    562562       practical  
  • trunk/docsrc/dcompiler.dd

    r1107 r1242  
    11Ddoc 
    22 
    3 $(D_S dmd - $(WINDOWS Windows)$(LINUX Linux)$(OSX Mac OSX) D Compiler, 
     3$(D_S dmd - $(WINDOWS Windows)$(LINUX Linux)$(OSX Mac OSX)$(FREEBSD FreeBSD) D Compiler, 
    44 
    55    $(UL  
     
    8282    ) 
    8383    $(WINDOWS 
    84     $(DT $(TT \dmd\windows\bin\dmd.exe) 
     84    $(DT $(TT $(DMDDIR)\windows\bin\dmd.exe) 
    8585    $(DD D compiler executable) 
    8686    ) 
    8787 
    88     $(DT $(TT \dmd\windows\bin\$(LINK2 http://www.digitalmars.com/ctg/shell.html, shell.exe)) 
     88    $(DT $(TT $(DMDDIR)\windows\bin\$(LINK2 http://www.digitalmars.com/ctg/shell.html, shell.exe)) 
    8989    $(DD Simple command line shell) 
    9090    ) 
    9191 
    92     $(DT $(TT \dmd\windows\bin\sc.ini) 
     92    $(DT $(TT $(DMDDIR)\windows\bin\sc.ini) 
    9393    $(DD Global compiler settings) 
    9494    ) 
    9595 
    96     $(DT $(TT \dmd\windows\lib\$(LIB)) 
     96    $(DT $(TT $(DMDDIR)\windows\lib\$(LIB)) 
    9797    $(DD D runtime library) 
    9898    ) 
     
    174174    Unzip the files in the root directory. 
    175175    $(TT dmd.zip) will create 
    176     a $(TT \dmd) directory with all the files in it. 
     176    a $(TT $(DMDDIR)) directory with all the files in it. 
    177177    $(TT dmc.zip) will create 
    178178    a $(TT \dm) directory with all the files in it. 
     
    400400        not compiling for symbolic debugging instead of $(B $(LIB)) 
    401401      ) 
     402      $(SWITCH $(B -deps=)$(I filename), 
     403        write module dependencies as text to $(I filename) 
     404      ) 
    402405 
    403406    $(UNIX 
     
    428431        add CodeView 4 symbolic debug info in C format 
    429432        for debuggers such as 
    430         $(TT \dmd\bin\windbg) 
     433        $(TT $(DMDDIR)\bin\windbg) 
    431434    ) 
    432435    $(UNIX 
     
    584587        verbose 
    585588      ) 
     589$(V2 
     590      $(SWITCH $(B -vtls), 
     591        print informational messages identifying variables defaulting 
     592        to thread local storage. Handy for migrating to shared model. 
     593      ) 
     594) 
    586595      $(SWITCH $(B -version=)$(I level), 
    587596        compile in $(LINK2 version.html#version, version level) >= $(I level) 
     
    615624 
    616625$(CONSOLE 
    617 set LIB=\dmd\lib;\dm\lib 
     626set LIB=$(DMDDIR)\lib;\dm\lib 
    618627) 
    619628 
     
    653662 
    654663$(CONSOLE 
    655 set LIB=\dmd\lib;\dm\lib 
     664set LIB=$(DMDDIR)\lib;\dm\lib 
    656665) 
    657666 
     
    662671 
    663672$(CONSOLE 
    664 set LINKCMD=\dm\bin\link 
     673set LINKCMD=\dmd\windows\bin\link 
    665674) 
    666675 
     
    744753    $(P The $(B %@P%) is replaced with the path to $(TT sc.ini). 
    745754    Thus, if the fully qualified file name $(TT sc.ini) is 
    746     $(TT c:\dmd\bin\sc.ini), then $(B %@P%) will be replaced with 
    747     $(TT c:\dmd\bin), and the above $(TT sc.ini) will be 
     755    $(TT c:$(DMDDIR)\bin\sc.ini), then $(B %@P%) will be replaced with 
     756    $(TT c:$(DMDDIR)\bin), and the above $(TT sc.ini) will be 
    748757    interpreted as: 
    749758    ) 
     
    751760$(SCINI 
    752761[Environment] 
    753 LIB="c:\dmd\bin\..\lib";\dm\lib 
    754 $(V1 DFLAGS="-Ic:\dmd\bin\..\src\phobos") 
    755 $(V2 DFLAGS="-Ic:\dmd\bin\..\src\phobos" "-Ic:\dmd\bin\..\src\druntime\import") 
    756 LINKCMD="c:\dmd\bin\..\..\dm\bin" 
     762LIB="c:$(DMDDIR)\bin\..\lib";\dm\lib 
     763$(V1 DFLAGS="-Ic:$(DMDDIR)\bin\..\src\phobos") 
     764$(V2 DFLAGS="-Ic:$(DMDDIR)\bin\..\src\phobos" "-Ic:$(DMDDIR)\bin\..\src\druntime\import") 
     765LINKCMD="c:$(DMDDIR)\bin\..\..\dm\bin" 
    757766DDOCFILE=mysettings.ddoc 
    758767) 
  • trunk/docsrc/faq.dd

    r989 r1242  
    3333 
    3434    $(LI I want to contribute to D 2.0. How can I effect that?) 
     35 
     36    $(ITEMR case_range, Why doesn't the case range statement 
     37     use the $(TT case X..Y:) syntax?) 
     38 
    3539    ) 
    3640 
     
    7781    ) 
    7882 
     83$(ITEM case_range, Why doesn't the case range statement 
     84     use the $(TT case X..Y:) syntax?) 
     85 
     86    $(P See the $(LINK2 statement.html#CaseRangeStatement, case range statement).) 
     87 
     88    $(P The usages of .. would then be: 
     89    $(OL 
     90    $(LI $(TT case X..Y:)) 
     91    $(LI $(TT foreach(e; X..Y))) 
     92    $(LI $(TT array[X..Y])) 
     93    ) 
     94    Case (1) has a VERY DIFFERENT meaning from (2) and (3). 
     95    (1) is inclusive of Y, and (2) and (3) are exclusive of Y. 
     96    Having a very different meaning means it should have a distinctly different syntax.  
     97    ) 
     98 
    7999$(ITEM q1, Why the name D?) 
    80100 
  • trunk/docsrc/function.dd

    r863 r1242  
    14371437        $(LI scope statements) 
    14381438        $(LI try-catch-finally statements) 
    1439         $(LI labelled break and continue statements) 
     1439        $(LI labeled break and continue statements) 
    14401440         ) 
    14411441    ) 
  • trunk/docsrc/glossary.dd

    r1096 r1242  
    184184    execute programs at compile time rather than runtime.) 
    185185 
     186    $(DT $(LNAME2 tls, $(ACRONYM TLS, Thread Local Storage))) 
     187    $(DD TLS allocates each thread its own instance of the 
     188    global data. See also 
     189    $(LINK2 http://en.wikipedia.org/wiki/Thread-Specific_Storage, Wikipedia).) 
     190 
    186191    $(DT $(ACRONYM UB, Undefined Behavior)) 
    187192    $(DD Undefined behavior happens when an illegal code construct is 
  • trunk/docsrc/index.dd

    r863 r1242  
    5050) 
    5151 
    52 $(P There are currently two implementations, the 
    53 dmd package for $(LINK2 dmd-windows.html, Windows) and 
    54 $(LINK2 dmd-linux.html, x86 Linux), 
    55 and the 
    56 $(LINK2 http://dgcc.sourceforge.net/, GCC D Compiler) package for 
    57 several platforms, including 
    58 $(LINK2 http://gdcwin.sourceforge.net/, Windows) 
    59 and 
    60 $(LINK2 http://gdcmac.sourceforge.net/, Mac OS X). 
     52$(P There are two versions of the language: 
     53$(OL 
     54    $(LI $(LINK2 http://www.digitalmars.com/d/1.0/index.html, D version 1) 
     55    which is stable.) 
     56    $(LI $(LINK2 http://www.digitalmars.com/d/2.0/index.html, D version 2) 
     57    which is the next generation under development.) 
     58
     59
     60 
     61$(P There are currently four implementations: 
     62$(OL 
     63    $(LI Digital Mars dmd for 
     64    $(LINK2 dmd-windows.html, Windows), 
     65    $(LINK2 dmd-linux.html, x86 Linux), 
     66    $(LINK2 dmd-osx.html, Mac OSX 10.5), and 
     67    $(LINK2 dmd-freebsd.html, x86 FreeBSD) 
     68    for D versions 1 and 2. 
     69    ) 
     70 
     71    $(LI LLVM D Compiler $(LINK2 http://www.dsource.org/projects/ldc, ldc) 
     72    for D version 1. 
     73    ) 
     74 
     75    $(LI Gnu D compiler $(LINK2 http://dgcc.sourceforge.net/, gdc) 
     76    for several platforms, including 
     77    $(LINK2 http://gdcwin.sourceforge.net/, Windows) and 
     78    $(LINK2 http://gdcmac.sourceforge.net/, Mac OS X) 
     79    for D versions 1.030 and 2.014. 
     80    ) 
     81 
     82    $(LI $(LINK2 http://dnet.codeplex.com/, D.NET compiler) 
     83    alpha for .NET for D version 2.) 
     84
    6185) 
    6286 
  • trunk/docsrc/lex.dd

    r989 r1242  
    11111111 
    11121112    $(B scope) 
    1113     $(B short) 
     1113$(V2 
     1114    $(B shared) 
     1115)   $(B short) 
    11141116    $(B static) 
    11151117    $(B struct) 
     
    11451147    $(B __FILE__) 
    11461148    $(B __LINE__) 
     1149    $(B __gshared) 
     1150    $(B __thread) 
    11471151    $(B __traits)) 
    11481152) 
  • trunk/docsrc/migrate-to-shared.dd

    r1167 r1242  
    9898    $(P becomes:) 
    9999--- 
    100 immutable table[3] x = [6, 123, 0x87]; 
     100immutable int[3] table = [6, 123, 0x87]; 
    101101--- 
    102102 
     
    149149 
    150150--- 
    151 __gshared x; 
     151__gshared int x; 
    152152 
    153153void main() 
  • trunk/docsrc/statement.dd

    r984 r1242  
    3636    $(GLINK ForeachStatement) 
    3737    $(GLINK SwitchStatement) 
    38     $(GLINK CaseStatement) 
    39     $(GLINK DefaultStatement) 
     38$(V2      $(GLINK FinalSwitchStatement) 
     39)    $(GLINK CaseStatement) 
     40$(V2      $(GLINK CaseRangeStatement) 
     41)    $(GLINK DefaultStatement) 
    4042    $(GLINK ContinueStatement) 
    4143    $(GLINK BreakStatement) 
     
    121123 
    122124$(GRAMMAR 
    123 $(I LabelledStatement): 
     125$(I LabeledStatement): 
    124126    $(I Identifier) : $(PSSEMI) 
    125127) 
    126128 
    127129$(P 
    128     Any statement can be labelled, including empty statements, 
     130    Any statement can be labeled, including empty statements, 
    129131    and so can serve as the target 
    130     of a goto statement. Labelled statements can also serve as the 
     132    of a goto statement. Labeled statements can also serve as the 
    131133    target of a break or continue statement. 
    132134) 
     
    323325$(GRAMMAR 
    324326$(I ForStatement): 
    325     $(B for $(LPAREN))$(I Initialize) $(I Test)$(B ;) $(I Increment)$(B $(RPAREN)) $(PSSCOPE) 
     327    $(B for $(LPAREN))$(I Initialize) $(I Test) $(B ;) $(I Increment)$(B $(RPAREN)) $(PSSCOPE) 
    326328 
    327329$(GNAME Initialize): 
     
    396398$(GRAMMAR 
    397399$(I ForeachStatement): 
    398     $(I Foreach $(LPAREN))$(I ForeachTypeList)$(B ;) $(I Aggregate)$(B $(RPAREN)) $(PS0) 
     400    $(I Foreach) $(B $(LPAREN))$(I ForeachTypeList) $(B ;) $(I Aggregate)$(B $(RPAREN)) $(PS0) 
    399401 
    400402$(GNAME Foreach): 
     
    807809    $(B case) $(I ExpressionList) $(B :) $(PSSEMI_PSCURLYSCOPE) 
    808810 
     811$(V2 $(GNAME CaseRangeStatement): 
     812    $(B case) $(I FirstExp) $(B : .. case) $(I LastExp) $(B :) $(PSSEMI_PSCURLYSCOPE) 
     813 
     814$(I FirstExp): 
     815    $(I AssignExpression) 
     816 
     817$(I LastExp): 
     818    $(I AssignExpression) 
     819) 
    809820$(GNAME DefaultStatement): 
    810     $(B default:) $(PSSEMI_PSCURLYSCOPE) 
     821    $(B default :) $(PSSEMI_PSCURLYSCOPE) 
    811822) 
    812823 
     
    821832    list of expressions. 
    822833    ) 
     834 
     835$(V2 
     836    $(P A $(I CaseRangeStatement) is a shorthand for listing a series 
     837    of case statements from $(I FirstExp) to $(I LastExp). 
     838    ) 
     839) 
    823840 
    824841    $(P If none of the case expressions match, and there is a default 
     
    843860$(V2 
    844861    The case expressions must all evaluate to a constant value 
    845     or array, or a runtime initialized const or invariant variable of 
     862    or array, or a runtime initialized const or immutable variable of 
    846863    integral type. 
    847864) 
     
    852869    $(P Case expressions must all evaluate to distinct values. 
    853870$(V2 
    854     Const or invariant variables must all have different names. 
     871    Const or immutable variables must all have different names. 
    855872    If they share a value, the first case statement with that value 
    856873    gets control. 
     
    926943    ) 
    927944 
     945$(V2 
     946<h2>$(LNAME2 FinalSwitchStatement, Final Switch Statement)</h2> 
     947 
     948$(GRAMMAR 
     949$(I FinalSwitchStatement): 
     950    $(B final switch $(LPAREN)) $(EXPRESSION) $(B $(RPAREN)) $(PSSCOPE) 
     951) 
     952 
     953    $(P A final switch statement is just like a switch statement, 
     954    except that:) 
     955 
     956    $(UL 
     957    $(LI No $(GLINK DefaultStatement) is allowed.) 
     958    $(LI No $(GLINK CaseRangeStatement)s are allowed.) 
     959    $(LI If the switch $(EXPRESSION) is of enum type, all 
     960    the enum members must appear in the $(GLINK CaseStatement)s.) 
     961    $(LI The case expressions cannot evaluate to a run time 
     962    initialized value.) 
     963    ) 
     964 
     965) 
    928966 
    929967<h2>$(LNAME2 ContinueStatement, Continue Statement)</h2> 
     
    10651103) 
    10661104 
    1067     A goto transfers to the statement labelled with 
     1105    A goto transfers to the statement labeled with 
    10681106    $(I Identifier). 
    10691107 
     
    11701208} 
    11711209-------------- 
     1210 
     1211$(V2 
     1212    $(P Use of with object symbols that shadow local symbols with 
     1213    the same identifier are not allowed. 
     1214    This is to reduce the risk of inadvertant breakage of with 
     1215    statements when new members are added to the object declaration. 
     1216    ) 
     1217--- 
     1218struct S 
     1219{ 
     1220    float x; 
     1221} 
     1222 
     1223void main() 
     1224{ 
     1225    int x; 
     1226    S s; 
     1227    with (s) 
     1228    { 
     1229        x++;  // error, shadows the int x declaration 
     1230    } 
     1231} 
     1232--- 
     1233) 
    11721234 
    11731235<h2>$(LNAME2 SynchronizedStatement, Synchronized Statement)</h2> 
     
    15231585-------------- 
    15241586 
     1587    $(P Semantically consecutive $(I AsmStatement)s shall not have 
     1588    any other instructions (such as register save or restores) inserted 
     1589    between them by the compiler. 
     1590    ) 
     1591 
    15251592<h2>$(LNAME2 PragmaStatement, Pragma Statement)</h2> 
    15261593 
     
    15751642$(GRAMMAR 
    15761643$(I ForeachRangeStatement): 
    1577     $(GLINK Foreach) $(LPAREN)$(GLINK ForeachType)$(B ;) $(I LwrExpression) $(B ..) $(I UprExpression) $(B $(RPAREN)) $(PSSCOPE) 
     1644    $(GLINK Foreach) $(LPAREN)$(GLINK ForeachType) $(B ;) $(I LwrExpression) $(B ..) $(I UprExpression) $(B $(RPAREN)) $(PSSCOPE) 
    15781645 
    15791646$(GNAME LwrExpression): 
  • trunk/docsrc/windbg.dd

    r850 r1242  
    33$(D_S Debugging D on Windows, 
    44 
    5 $(P The Microsoft Windows debugger $(TT \dmd\bin\windbg.exe) can be used to 
     5$(P The Microsoft Windows debugger $(TT $(DMDDIR)\bin\windbg.exe) can be used to 
    66symbolically debug D programs, even though it is a C++ debugger. 
    77Versions of $(TT windbg.exe) other than the one supplied may not work with D. 
     
    5757 
    5858$(P For more comprehensive information on $(B windbg), consult the 
    59 file $(TT \dmd\bin\windbg.hlp). 
     59file $(TT $(DMDDIR)\bin\windbg.hlp). 
    6060) 
    6161 
  • trunk/docsrc/windows.dd

    r1157 r1242  
    5353 
    5454    $(P Windows GUI applications can be written with D. 
    55     A sample such can be found in $(TT \dmd\samples\d\winsamp.d) 
     55    A sample such can be found in $(TT $(DMDDIR)\samples\d\winsamp.d) 
    5656    ) 
    5757