On Tuesday, 14 November 2023 at 17:57:36 UTC, Steven
Schveighoffer wrote:
That's not any better. If you have to opt-in to the language as
it exists, people are going to quit immediately.
Counterpoint: javascript's "use strict".
On the gripping hand though, I basically never use that and most
people prolly don't either. But it is a major language example we
ought to consider.
* * *
But for existing libraries, I actually have a potential solution
for that: made dub look at the version tag date.
So, suppose dub determines it wants to use abandoned-library
version 1.4. It knows version 1.4 was tagged on December 25, 2016.
This could automatically go ahead and add
`-edition=abandoned.library=2.092` to the build command for that
lib.
Notice that build command used a package specifier, if an edition
is specified on the command line, it *MUST* be scoped to a
specific module (or D package, just like how `-i` works) so when
it is imported, the compiler can attach the edition tag there
without affecting other things in the build.
It would basically work like you pass
`-edition=abandoned.library=2.092` on the cmd line and the
compiler acts exactly the same as if you wrote `@edition(2.092)`
when it sees `module abandoned library`.
On the other hand, suppose dub sees a new tag, version 2.0,
created in 2024. This will be edition 2.107 since it has a date
range to version map.
We'd have to work out the exact details, but just since dub knows
the tag date it can make a pretty good automatic guess as to the
proper version.