a(b(c(d(e),3))
? Not very readable. UFCS (Universal Function Call Syntax) enables it to be written as: e.d.c(3).b.a();
Reading it flows naturally left-to-right. a(b(c(d(e),3))
? Not very readable. UFCS (Universal Function Call Syntax) enables it to be written as: e.d.c(3).b.a();
Reading it flows naturally left-to-right. e.d.c(3).b.a
which is even cleaner.For those who are thinking UFCS is a trivial detail, consider that the shell and some other languages have pipe operators (|>) to make the code flow intuitively the same way as the data.
In my opinion, in a C-like language, managing to squeeze so much functionality out of the '.' operator without any downsides is the mark of a well thought out, elegant language.
Thank you for creating D.
For example, in C++, a = b can invoke anything. Not sure it is a good idea (except for generic code, there it is useful).
Zig has a philosophy of nothing hidden that I think it is mostly good.
That said, I find D a very nice language, the only problems are:
1. small ecosystem 2. last time I tried, packaging of download and use was... improvable.
Naively, I would think that making template instantiation look the same as a function call would be a desirable feature, with ambiguous calls needing to be resolved by the user.
templ!thing(a,b)
I would have thought that templ(thing)(a,b) would have been a good solution, as it is what is used in the declaration/definition side of templates, but this would have made removing redundant () not possible in UFCS expressions. templ<thing>(a, b)
because with that: templ!thing(a, b)
is it a function?, or are you calling thing's function?you can do:
templ!(thing)(a, b)
but did you mean?: templ!(thing(a, b))()
i personally always use !(), no matter what, and it's annoying to type, i don't want to waste time constantly trying to figure out what is what, it's mentally draining