[Issue 9289] Deprecated language features should be warn too when errors are normally silented
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jan 30 02:32:22 PST 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9289
--- Comment #14 from Leandro Lucarella <leandro.lucarella at sociomantic.com> 2013-01-30 02:32:17 PST ---
Comment from don to the pull request:
> Although this idea is appealing in some circumstances (specifically,
> when you have just upgraded from one compiler version to another), in
> others it is NOT what you want, and it breaks existing code. Using
> your test case, suppose you have the code:
>
> ---
> auto foo(P)(P p){
> static if ( is(typeof( *p)) {
> return *p;
> } else static if (is(typeof(p[0])) {
> return p[0];
> } else static assert(0, "unsupported");
> }
> ---
>
> Currently, if -d is not specified, passing an array to this will work
> correctly: the second return will be used. If -d is specified, it will
> also work correctly: the first return will be used. With your patch,
> the code will not work at all. If I have a codebase where I never
> even use -d, this pull request is suddenly making that obscure,
> stupid, long-deprecated feature have an impact on my code!
>
> I think we just have to accept that having deprecated features still
> accepted in the language is a major annoyance. I'm not sure that there
> is a perfect solution. We should really try to get rid of them.
The first one will work correctly *BUT* you'll get the warning, so you can
inspect the code and fix it. I think this solution is not worse than the
current situation where what previously had fail, now passes silently.
If you are using deprecated features in your code, your code is broken (or at
least outdated) and you should fix it (or update it). Now those obscure changes
on behaviour are there, and you'll never find out. This pull request gives
visibility to this issues and allows you to update your code.
I really don't see the problem with this solution. I don't think is a big
annoyance. The default behaviour is to warn you when you are using something
that's deprecated so you can update it.
--
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