On Tue, 20 Jan 2015 14:45:26 +
bearophile via Digitalmars-d-learn
wrote:
> ketmar:
>
> > Jonathan explains it very well. i can add the only thing: don't
> > use `const` until you forced to. ;-)
>
> In D use immutable (or const) everywhere you can. Possibly mark
> as immutable everything d
ketmar:
Jonathan explains it very well. i can add the only thing: don't
use `const` until you forced to. ;-)
In D use immutable (or const) everywhere you can. Possibly mark
as immutable everything doesn't need to mutate.
sure, you can cast `const` away in your code, but using `cast`
is a
On Tue, 20 Jan 2015 09:29:45 +
qqiang via Digitalmars-d-learn
wrote:
> I am writing a tree data structure, and I have the following code:
>
> ```D
> final class Node {
> private {
> int val_;
> Node parent_;
> Node left_;
> Node right_;
> }
>
> @proper
On Tuesday, January 20, 2015 09:29:45 qqiang via Digitalmars-d-learn wrote:
> I am writing a tree data structure, and I have the following code:
>
> ```D
> final class Node {
> private {
> int val_;
> Node parent_;
> Node left_;
> Node right_;
> }
>
> @property
> const(N
On Tuesday, 20 January 2015 at 09:29:46 UTC, qqiang wrote:
I am writing a tree data structure, and I have the following
code:
```D
final class Node {
private {
int val_;
Node parent_;
Node left_;
Node right_;
}
@property
const(Node) maximum() con
I am writing a tree data structure, and I have the following code:
```D
final class Node {
private {
int val_;
Node parent_;
Node left_;
Node right_;
}
@property
const(Node) maximum() const {
auto ret = this;