20 karma · joined November 27, 2017
It's basically, (C(n) + M(n) + kD(n)) / n
Where M is moves, C is comparisons, k is a some constant, and D is "distance".
And are there any languages where lazy is not a failure in your opinion?
Edit: removed link to wrong swift feature proposal.
Template arguments need to be known at compile time, and the extra set of parens is how templates parameters are declared in D.
The docs on static if may shed some more light: https://dlang.org/spec/version.html#staticif
There's a wanting implementation of a sumtype in the standard library (https://dlang.org/phobos/std_variant.html#.Algebraic), and a much better one as a package: https://code.dlang.org/packages/sumtype
Another reason is the (ironically) dynamic nature of a return type. E.g.
auto whatDoesItReturn(int i)() { static if (i == 0) { return int.init; } else { return string.init; } }
Template code can do that quite easily and then you don't have a choice but to write auto as the return value.
What would be fantastic if the documentation could be given access to the the compiler's return type inference, so that it could document the auto returns with a little more info.
Another way useful approach would be to implement protocols like in swift, or traits like in scala/rust/others, signatures in ml, etc. Then you would be able to define the interface of what a function returns.
https://www.theregister.co.uk/2018/11/30/wekaio/
https://www.hpcwire.com/off-the-wire/wekaio-places-in-top-fi...