If you could make any changes to D, what would they look like?
H. S. Teoh
hsteoh at quickfur.ath.cx
Tue Oct 26 00:01:20 UTC 2021
On Mon, Oct 25, 2021 at 06:06:27PM +0000, Paul Backus via Digitalmars-d wrote:
> On Monday, 25 October 2021 at 17:45:22 UTC, H. S. Teoh wrote:
> > I suspect part of this problem is caused by the lame specialcased
> > behaviour of template instantiation errors being ignored when it's
> > opDispatch. It's D's version of C++'s SFINAE, which leads to all
> > sorts of stupidity like a typo inside opDispatch suddenly causing a
> > dispatched member to disappear from existence 'cos the compiler
> > swallows the error and pretends the member simply doesn't exist. So
> > if you're introspecting the member, the introspection code doesn't
> > even see it. Which leads to hours of head-scratching over "I
> > obviously declared the darned member, why does the code NOT see
> > it?!?!".
> It's actually worse than that. Errors inside `opDispatch` are gagged
> and cause member lookup to fail...*unless* they're nested inside
> *another* template, in which case member lookup will succeed, and you
> will only get the error when you try to actually access the member:
> It's special cases inside of special cases--a complete mess.
Wow, that's totally messed up. :-/ Yeah, if there's any way to fix this
without breaking existing code, I'd love to push for this change in the
language. Not holding my breath for it, though, unfortunately.
Trying to define yourself is like trying to bite your own teeth. -- Alan Watts
More information about the Digitalmars-d