Const (computer programming): Difference between revisions

Content deleted Content added
WikiCleanerBot (talk | contribs)
m v2.04b - Bot T20 CW#61 - Fix errors for CW project (Reference before punctuation)
No edit summary
Tags: Visual edit Mobile edit Mobile web edit
Line 309:
 
== D ==
In Version 2 of the [[D (programming language)|D programming language]], two keywords relating to const exist.<ref>{{cite web|url=http://www.digitalmars.com/d/2.0/const-faq.html#const |title=const(FAQ) – D Programming Language |publisher=Digitalmars.com |date= |accessdate=2013-08-18}}</ref> The <code>immutable</code> keyword denotes data that cannot be modified through any reference.
The <code>const</code> keyword denotes a non-mutable view of mutable data.
Unlike C++ <code>const</code>, D <code>const</code> and <code>immutable</code> are "deep" or [[transitive relation|transitive]], and anything reachable through a <code>const</code> or <code>immutable</code> object is <code>const</code> or <code>immutable</code> respectively.
 
'''Example of const vs. immutable in D'''