Changeset 1386

Show
Ignore:
Timestamp:
12/15/09 16:23:11 (2 years ago)
Author:
walter
Message:

bugzilla 3580 Update docs s/invariant/immutable/

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/docsrc/const-faq.dd

    r833 r1386  
    1818    $(ITEMR java-const, Why did Java reject const?) 
    1919    $(ITEMR cpp-const, How does const differ in C++?) 
    20     $(ITEMR invariant-strings, Why are strings invariant?) 
     20    $(ITEMR invariant-strings, Why are strings immutable?) 
    2121    $(ITEMR const-parameters, Why aren't function parameters const by default?) 
    2222    $(ITEMR static-members, Are static class members covered by transitive const?) 
    23     $(ITEMR invariant, What is $(I invariant) good for?) 
     23    $(ITEMR invariant, What is $(I immutable) good for?) 
    2424    ) 
    2525 
    2626$(ITEM const, Why does D have const?) 
    2727 
    28     $(P People often express frustration with const and invariant 
     28    $(P People often express frustration with const and immutable 
    2929    in D 2.0 and wonder if it is worth it. 
    3030    ) 
     
    202202    $(OL 
    203203    $(LI const is not transitive) 
    204     $(LI no invariants) 
     204    $(LI no immutables) 
    205205    $(LI const objects can have mutable members) 
    206206    $(LI const can be legally cast away and the data modified) 
     
    208208    ) 
    209209 
    210 $(ITEM invariant-strings, Why are strings invariant?) 
    211  
    212     $(P $(LINK2 http://dobbscodetalk.com/index.php?option=com_myblog&show=Invariant-Strings.html&Itemid=29, Invariant Strings) 
     210$(ITEM invariant-strings, Why are strings immutable?) 
     211 
     212    $(P $(LINK2 http://dobbscodetalk.com/index.php?option=com_myblog&show=Invariant-Strings.html&Itemid=29, Immutable Strings) 
    213213    ) 
    214214 
     
    254254    ) 
    255255 
    256 $(ITEM invariant, What is $(I invariant) good for?) 
    257  
    258     $(P Invariant data, once initialized, is never changed. 
     256$(ITEM invariant, What is $(I immutable) good for?) 
     257 
     258    $(P Immutable data, once initialized, is never changed. 
    259259    This has many uses: 
    260260    ) 
    261261 
    262262    $(UL 
    263     $(LI Access to invariant data need not be synchronized 
     263    $(LI Access to immutable data need not be synchronized 
    264264    when multiple threads read it.) 
    265265    $(LI Data races, tearing, sequential consistency, and 
    266266    cache consistency are all non-issues when working with 
    267     invariant data.) 
    268     $(LI Pure functions can only accept invariant parameters.) 
     267    immutable data.) 
     268    $(LI Pure functions can only accept immutable parameters.) 
    269269    $(LI When doing a $(I deep copy) of a data structure, 
    270     the invariant portions need not be copied.) 
     270    the immutable portions need not be copied.) 
    271271    $(LI Invariance allows a large chunk of data to be treated 
    272272    as a value type even if it is passed around by reference 
    273273    (strings are the most common case of this).) 
    274     $(LI Invariant type provides more self-documenting information 
     274    $(LI Immutable type provides more self-documenting information 
    275275    to the programmer.) 
    276     $(LI Invariant data can be placed in hardware protected read-only 
     276    $(LI Immutable data can be placed in hardware protected read-only 
    277277    memory, or even in ROMs.) 
    278     $(LI If invariant data does change, it is a sure sign of a memory 
     278    $(LI If immutable data does change, it is a sure sign of a memory 
    279279    corruption bug, and it is possible to automatically check for 
    280280    such data integrity.) 
    281     $(LI Invariant types provide for many program optimization 
     281    $(LI Immutable types provide for many program optimization 
    282282    opportunities.) 
    283283    ) 
    284284 
    285     $(P $(I const) acts as a bridge between the mutable and invariant 
     285    $(P $(I const) acts as a bridge between the mutable and immutable 
    286286    worlds, so a single function can be used to accept both types 
    287287    of arguments.)