Blog post: What D got wrong

Steven Schveighoffer schveiguy at gmail.com
Tue Dec 11 14:38:25 UTC 2018


On 12/11/18 5:45 AM, Atila Neves wrote:
> A few things that have annoyed me about writing D lately:
> 
> https://atilanevesoncode.wordpress.com/2018/12/11/what-d-got-wrong/

Agree with most of this. UFCS for templates would be awesome, but the 
syntax is trickier, since instantiation uses ! instead of .

I can't see how you get around the ambiguities, especially when a 
template could be a UFCS function.

inout: template This doesn't work the same (no guarantee it doesn't 
mutate the data). And it still generates multiple copies of the same 
function. As I said in my dconf 2016 presentation and in numerous 
debates on this forums, the only reason to care about const or inout is 
if you care about mutability guarantees on the callee. We can make do 
with templates and immutable without either of those features.

@property: This was almost about to be awesome, but squabbling amongst 
the D core team killed it. Now, it's only a very obscure difference:

struct S
{
    int _x;
    int x1() { return _x; }
    @property int x2() { return _x; }
}

pragma(msg, typeof(S.x1)); // int()
pragma(msg, typeof(S.x2)); // int


Which is COMPLETELY USELESS, since you have to handle both cases anyway.

-Steve


More information about the Digitalmars-d-announce mailing list