Georg Wrede wrote:
Jason House wrote:
Georg Wrede Wrote:
--- Disclaimer: this is a bit long. Read it later. ---
Wow, you're right. Sadly, I stopped reading about 80% through
(discussion on D4)
Yeah, one should not write opinion pieces when inspired...
At a high level, I agree with your assessment about an easy growth
path for newbors to gurus. I should also add that a language must
make the code of gurus remain understandable for all but the newest
of newbies. (Ever try to read through STL or a boost library?)
(Yeah, reading that kind of code makes one feel inferior to the gurus.
And so very sad that the language makes even mid-level stuff entirely
uncomprehensible. Not to speak of the amounts of time it has to take
coding it.)
Strictly speaking, there's no way for a language to make guru code
understandable to "anti-gurus". However (and what I guess you were
thinkng of), when somebody uses the most advanced features in a
language, then his stuff should not become incomprehensible to
"anti-gurus" just because of the language itself.
Two possible language features should make complicated template code
significantly simpler:
1. Allow inner name promotion even if the template defines other
members, as long as they are all private:
now:
template WidgetImpl(A, B) {
...
alias ... Result;
}
template Widget(A, B) {
alias WidgetImpl!(A, B) Widget;
}
proposed:
template Widget(A, B) {
private:
...
alias ... Result;
public:
alias Widget Result;
}
It's needed very frequently, puts sand in the eye, and almost sure to
throw off the casual reader.
2. Handle qualifiers and ref properly. Right now I use an abomination:
enum bool byRef = is(typeof(&(R.init.front())));
/// @@@UGLY@@@
/**
Forwards to $(D _input.back).
*/
mixin(
(byRef ? "ref " : "")~
q{ElementType!(R) front()
{
return _input.back;
}
});
Andrei