Const (computer programming): Difference between revisions

Content deleted Content added
Distinction from constants: rewrite for specificity
D: revert old IP vandalism
Line 312:
 
== 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 , and anything reachable through a <code>const</code> or <code>immutable</code> object is <code>const</code> or <code>immutable</code> respectively.