D and Nim
bearophile via Digitalmars-d
digitalmars-d at puremagic.com
Sun Jan 4 16:27:23 PST 2015
Walter Bright:
> Nim:
>
> for neighbour in nodes[nodeId].neighbours:
>
> D:
>
> foreach(immutable route neighbour; nodes[nodeID].neighbours){
>
> Correctly written D:
>
> foreach (neighbour; nodes[nodeID].neighbours){
I don't agree, the good D way is:
foreach (immutable neighbour; nodes[nodeID].neighbours) {
D programmers should apply const/immutable to every variable that
doesn't need to mutate.
Bye,
bearophile
More information about the Digitalmars-d
mailing list