You are a stupid programmer, you can't have that
H. S. Teoh
hsteoh at quickfur.ath.cx
Tue Aug 10 20:18:29 UTC 2021
On Tue, Aug 10, 2021 at 07:23:52PM +0000, Alexandru Ermicioi via Digitalmars-d wrote:
> On Tuesday, 10 August 2021 at 19:18:47 UTC, H. S. Teoh wrote:
> > Of course, in practice this will add a whole ton of extra work for
> > the compiler devs, especially once the number of supported language
> > versions increases. And it's not clear what to do if an older
> > language construct has to interact with a newer, incompatible
> > language feature. So I'm not sure how practical this will be. But
> > if we could somehow pull it off, then we could *both* evolve the
> > language and retain backward compatibility at the same time.
[...]
> Better in this case to have semi or full code migrator, that will
> automatically upgrade source code to latest version of d compiler.
> Then you won't require any extensive support of older versions of
> language, in the compiler itself.
This has been brought up many times, but I still see no actual progress
in this area.
We really need to make dfix a part of the official compiler default
installation so that it's officially supported, and not merely an
afterthought.
Or even better yet, make it a part of the compiler (or at least
auto-spawned by the compiler, the same way the linker is). The less
external tools the user needs to manually invoke to make the upgrade
happen, the better. In the ideal scenario, the act of running the
compiler would auto-upgrade the source code in-place, and compile that
instead of the original code.
Of course, this may be too intrusive, so maybe hide it behind a compiler
switch? When the switch is specified the compiler invokes dfix on the
user's behalf, replaces the input file(s) with the upgraded versions,
and compiles them, all in one go. Imagine how much better it is, if we
could just:
apt-get install dmd # upgrade dmd, including dfix
dmd -i -auto-upgrade my_project/*.d -of=profit
./profit
and have everything Just Work(tm), rather than having to:
apt-get install dmd # upgrade compiler
dmd -i my_project/*.d -of=profit # tons of compile errors
dfix # oops, dfix not up-to-date
dmd -i my_project/*.d -of=profit # still compile errors
apt-get install dfix # need to upgrade dfix
dfix
dmd -i my_project/*.d -of=profit # about time
./profit # already lost profit here :-P
T
--
Amateurs built the Ark; professionals built the Titanic.
More information about the Digitalmars-d
mailing list