[Issue 8220] invalid function call not detected during semantic analysis

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jun 21 14:32:09 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8220



--- Comment #9 from klickverbot <code at klickverbot.at> 2012-06-21 14:34:32 PDT ---
(In reply to comment #7)
> This example has been around a long time, and I've been telling people that
> that's the way to do it. I'm really reluctant to break it, and there doesn't
> seem to be an obvious other way to do it.

Just use typeof(U.init * V.init).

The idea might have seemed nice originally, but I think it has to go the 'bit'
route. At least in my opinion, allowing types to be used in place of
expressions is one of the most confusing things you can do to the poor
programmers out there. I recall stumbling over strange behavior is(typeof(…))
several times in the past, and this might have well been the reason.

What's more, is this interpretation backed by the spec in any way? If not, I
can hardly imagine that any alternative frontend would implement typeof() like
this.

To restate my point, typeof(<code>) acting differently than just <code> is a
huge source of confusion (constant folding and apparent null pointer
dereferences in typeof() can be bad enough already). There would have to be a
very good excuse not to remove this special case.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list