4 ms·
Except it's not entirely explicit. It allows the type name of the object being constructed to be elided. Per the article, this is the explicit form: var g
by dleslie 2y ago
Except it's not entirely explicit. It allows the type name of the object being constructed to be elided.
Per the article, this is the explicit form:
var gpa = std.heap.GeneralPurposeAllocator(std.heap.GeneralPurposeAllocatorConfig{}){};
- superb_dev 2y agoI don’t think type elision make the codes execution less explicit. Nothing else could go there
- necovek 2y agoThat's a textbook definition of "implicit", as in not directly specified, but assumed. The fact that unacceptable parameter would fail compile time validation does not make it any more readable.
- dleslie 2y agoConsider this: var foo = OpaqueTypeName(.{}){}; What is the . eliding? You don't know. I don't know. It's impossible to tell because the type is opaque to our understanding.
- deleted 2y ago[deleted]