Dlang
Primer
Builtin Types
I like the fact that we can directly access type properties via (no pun intended) properties.
The basic types are pretty much similar to C/C++ but with better consistency. For example, we have default initializations, also deterministic bit length of each type.
Data structures
Arrays
Symbols Table
The syntax is simple and actually similar to Golang: valueType[keyType].
The literal is different though, and it’s simpler than Go counterpart:
int[string] dict = ["a": 1, "b": 2];
In fact, I feel like Dlang syntax is more concise and easier to read than Go.
For example, let define a Trie structure using symbols table:
class Trie {
Trie[dchar] children;
bool isEnd;
Trie opIndex(dchar c) => children.require(c, new Trie());
}
Resources
- Introduction to metaprogramming in D: Metaprogramming in D - Bradley Chatha