Am 06.09.2011, 00:05 Uhr, schrieb Andrej Mitrovic
<andrej.mitrov...@gmail.com>:
On 9/5/11, Walter Bright <newshou...@digitalmars.com> wrote:
It prints out all the deprecation message. It means I'll have to go edit
existing, working code to change the names.
It would really help out if we had some sort of semi-automated script
that can do at least partial translation of code that uses old phobos
functions to new ones. Maybe this wouldn't work 100% but at least it
would help out. I'm thinking of something similar to what Python 2to3
does.
I know for sure I could use this, so far I've had to fix the
DWinSamples for every DMD/Phobos release.
It would help to have a lexical analyzer of the kind that allows for the
refactorings in for example Eclipse for Java. Without clear identification
of symbols it is impossible to write such a script for every new D
release. And there were other changes in the past where this would have
been handy although I have not writing any D code lately to feel the
breakage. I think of globals (__gshared).
I'm on the extreme with my urge to rewrite things if they give me the
slightest feeling that they could be more elegant or effective and I've
thought of such a script as well that could be distributed with every new
D version while there are still breaking changes to the language. Well,
you cannot write a script without a solid foundation that can reliably
identify and refactor symbols.
But this doesn't work well for code you copy from blogs. You would have to
know what D version it was written with and run the matching chain of
conversion scripts. Anyway this feels like some crazy idea that can't make
it into existence.
Still I have that picture of downloading a new D release and running the
obligatory dmdup script to replace deprecated functionality or names with
the new versions. Sure at some point 'this is it' and features of D and
Phobos become set in stone. "Hello world!" console output is one of those
examples that many will try first. I would understand if it breaks between
major versions of a language, but not from one revision to the next. YMMV
:)