Project Elvis

user1234 user1234 at 12.12
Tue Nov 7 13:43:20 UTC 2017


On Monday, 6 November 2017 at 20:14:17 UTC, Meta wrote:
> [...]
> import std.stdio;
> writeln(safeDeref(tree).right.right.val.orElse(-1));
> writeln(safeDeref(tree).left.right.left.right.orElse(null));
> writeln(safeDeref(tree).left.right.left.right.val.orElse(-1));
>
> vs.
>
> writeln(tree?. right?.right?.val ?: -1);
> writeln(tree?.left?.right?.left?.right);
> writeln(tree?.left?.right?.left?.right?.val ?: -1);
>
> The functionality is probably a good idea, but a library 
> solution is doable today without any acrobatics.

Show me a library solution that works fine with IDE completion 
(so for the safe navigation operator, not the Elvis one).


More information about the Digitalmars-d mailing list