Thoughts on versioning

Steven Schveighoffer schveiguy at gmail.com
Wed Oct 27 14:51:06 UTC 2021


On 10/27/21 10:22 AM, Adam D Ruppe wrote:

> * Removing autodecoding in v2 makes it more general. You can always 
> write an autodecode function in terms of a plain function - just do a 
> wrapper that adds the decode adapter.

I wish this were true. But there is a fundamental problem with 
autodecode -- Phobos claims, for example, that a `string` has no 
indexing, yet you can index it. `hasLength!string` is false, yet 
`someString.length` works. There are a large amount of places where you 
can use strings, that you can't use some wrapped autodecoding range. 
Want to implicitly cast a `string` to a `const(char)[]`? No problem! Try 
doing this with a custom type.

There is literally no way to reproduce the abomination known as an 
autodecoding for backwards compatibility. I tried.

And given that a major focus of v2 is going to be ridding the library of 
autodecoding, it means a huge segment of code will need to be redone. I 
was actually kind of surprised how much I had to change when I was 
trying to do it. It gets to the point where you are thinking "why are we 
trying to save this code? Let's just rewrite it".

-Steve


More information about the Digitalmars-d mailing list