On Friday, 11 December 2015 at 08:30:21 UTC, Martin6265 wrote:
But the syntax of it will be like calling template func, and
its not desirable.
The trick is in the simplicity of the pattern not only in
functionality.
No, by using UFCS and IFTI, the syntax of `maybe` becomes even
better than C#'s `?.`. See:
// http://dlang.org/glossary.html
// UFCS: https://dlang.org/spec/function.html#pseudo-member
// IFTI: https://dlang.org/spec/template.html#variadic-templates
(search for "implicit")
struct Node
{
int val;
Node* left, right;
}
void main()
{
import std.stdio;
auto tree = new Node(1,
new Node(2),
new Node(3,
null,
new Node(4)
)
);
writeln(tree.maybe.right.right.val);
writeln(tree.maybe.left.right.left.right);
writeln(tree.maybe.left.right.left.right.val);
}
// Full source: http://dpaste.dzfl.pl/8b5dcec7aaf3
Look, Im developing multiplatform GUI framework (based on .NET
conventions and Cocoa) & ID.
I'm interested to know more about the multiplatform GUI framework
you are developing. What are the main features, goals and design
ideas, architecture and programming model?
I can make my custom version of D (anyway, Ill distribute it as
a one package product) but Im not happy to make new,
uncompatibile version.
What do you miss the most in D? What would you change to be
worthwhile the effort to distribute a custom version of D?
Before learning about D, I worked on UI components with C#/WPF|SL
so I can understand that in the beginning it seems that C# is
better in some stuff than D. However now I would never go back to
C# and .NET, because I would miss so much of D's features and I
don't remember anything that I miss from C# and .NET.