On 11-11-2012 14:18, Leandro Lucarella wrote:
On Wednesday, 7 November 2012 at 07:03:55 UTC, monarch_dodra wrote:
On Tuesday, 6 November 2012 at 23:56:13 UTC, Walter Bright wrote:
I know there's been some long term unhappiness about the deprecated
attribute - it's all-or-nothing approach, poor messages, etc. Each
change in it changes the language and the compiler.

I *just* had a conversation about this, but there *needs* to be a way
to to tell the compiler: "don't use deprecated stuff": If it merely
issues a warning, then you'll end up calling deprecated code, because
traits will answer positively to something that is actually deprecated:

For example if a range has "deprecated opIndex", and you try a search
on that range, the implementation will take the RA road...

I had proposed a "three state -d":
-- : Deprecated stuff just can't be used
-d : You can use deprecated stuff, but you get no warning
-dw : You can use deprecated stuff, and are served with a warning

BTW, I already implemented that and is available as a pull request (I
just called the option -di to follow the naming of -wi).
https://github.com/D-Programming-Language/dmd/pull/1185

This pull request is available since July 2011 (was pull #248 back
then), and I'm trying to convince Walter to merge it since then without
any success. I'm really glad this finally came up here, maybe he finally
understand the importance of having an usable deprecated implementation :)

BTW, I think the default should be to have deprecations as warnings and
not the other way around, but since I at least have the option to make
them warnings, I'm fine.

Yes, definitely warnings by default. The current system makes the deprecated keyword useless in practice for libraries because it can break arbitrary build systems out there.

--
Alex Rønne Petersen
[email protected]
http://lycus.org

Reply via email to