Thoughts on versioning

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Oct 27 17:16:16 UTC 2021


On Wed, Oct 27, 2021 at 01:04:25PM -0400, Steven Schveighoffer via Digitalmars-d wrote:
> On 10/27/21 12:33 PM, H. S. Teoh wrote:
> > On Wed, Oct 27, 2021 at 03:06:10PM +0000, Adam D Ruppe via Digitalmars-d wrote:
> > > On Wednesday, 27 October 2021 at 14:51:06 UTC, Steven Schveighoffer wrote:
> > > > There is literally no way to reproduce the abomination known as
> > > > an autodecoding for backwards compatibility. I tried.
> > > 
> > > in that case realistically you can't make a v2 act sane to strings
> > > when built on v1 either, meaning the only choice is to rewrite
> > > (aka copy/paste aka fork) as needed.
> > > 
> > > I'm ok with that.
> > 
> > Couldn't we just do something like this?
> > 
> > 	// Phobos v1
> > 	auto someStringFunc(R)(R range)
> > 	{
> > 		static if (willAutoDecode!R) {
> > 			// old v1 code here
> > 		} else {
> > 			// thin wrapper over v2 code
> > 		}
> > 	}
> 
> I'm not seeing the point. Why wrap v2 code when you are going to have
> to maintain the v1 code anyway?

I thought the you guys were arguing for making Phobos v1 a thin wrapper
that forwards to v2 code.  If you wanted to retain a copy of v1 code,
then this problem wouldn't come up at all?


> Plus, now it's a template that accepts ranges. Like it or not,
> `someStringFunc(string)` is not the same as `someStringFunc(R)(R)`.
[...]

Point.  So what, does that mean we're stuck with keeping v1 code around
forever?

Honestly, I think a more practical approach is to give up the
perfectionist ideal of old code compiling forever (the D community
simply does not have the resources to maintain such a thing, unlike,
say, MS Windows), and just do a best-efforts v1 emulation in v2 code,
that will mostly work but may have a few rare cases where it won't
compile, etc.. Then users just change the few bits that broke, and can
continue enjoying v2 benefits.

//

Alternatively, here's a different approach: make v1 code a dub package,
then break upstream Phobos at will to make v2.

Well OK, maybe have a transitional period where we maintain a copy of v1
code around, but with big fat warnings that within N months/years/etc.
you will need to use the v1 dub package to continue compiling the code,
or migrate to v2 now.  Once the transition period is over, we shed v1
code from upstream, but keep the dub package around for people who need
it. There will be no more new features, only non-breaking bugfixes.


T

-- 
It only takes one twig to burn down a forest.


More information about the Digitalmars-d mailing list