r/programming • • Aug 20 '20

Announcing TypeScript 4.0

https://devblogs.microsoft.com/typescript/announcing-typescript-4-0/
1.3k Upvotes

236 comments sorted by

View all comments

Show parent comments

269

u/StillNoNumb Aug 20 '20 edited Aug 20 '20

See here

The trade-off for getting millions of dollars of engineering investment in the TypeScript project is that marketing gets to control version numbers to a certain extent.

It's not really an unalloyed good anyway. If we followed semver rules exactly, literally every single release would be a major version bump. Any time we produced the wrong type or emitted the wrong code or failed to issue a correct error, that's a breaking change, and we fix dozens of bugs like that in every release. The middle digit just isn't useful for TypeScript in a strict semver interpretation.

Certainly annoying, but no one would pay as much attention to TS releases if we were at v40 already. Given that TypeScript is a pretty central part of the ecosystem it's acceptable pain imo, but I really hope that no other, smaller package authors see that and decide to ignore semver because TS does.

100

u/crabmusket Aug 21 '20

IMO if you're not doing semver, do calendar versioning like Ubuntu (YY.MM) or dgraph.

13

u/BesottedScot Aug 21 '20

Always liked Ubuntu's versioning.

11

u/teszes Aug 21 '20

It also helps underline how out of date a version may be and if it needs to be updated.

"We are still on version 2002" hits harder than "version 3.4".

5

u/BesottedScot Aug 21 '20

Aye unless you're Microsoft and like to play guess what version of SQL you're on.

2

u/DreamyRustacean Aug 21 '20

OMG, my least favorite game! MS version numbers can die in a fire!

→ More replies (2)

4

u/Lafreakshow Aug 21 '20

Dunno, I always thought Semantic Versioning specially for projects with breaking changes regularly should be a thing.

I don't like their current system though, Major versions should be reserved for... well... major milestones like reaching the first full featured version or adding a major new feature or completely changing how the thing works. Kind of like a difference between breaking changes one could relatively easily migrate to and breaking changes would require significant work to migrate.

I guess simply leaving off the patch number of a semantic version would be pretty confusing but you get what I mean, a standardized, easily comparable way in the vein of semantic versioning but with only minor and major parts. It should probably have some kind of identifier so it's easy to differentiate from regular semantic versioning, especially since minor changes in semantic versioning shouldn't be breaking. maybe one could a a letter to the minor part or something like that. Like so: "1.b3.3". The "b" indicating a minor version that should be expected to contain breaking changes. Note that there is still a third part for non breaking patches but I would consider that optional.

I don't know if this goes completely against the idea behind semantic versioning, I also don't think it must be this, I'd just like a standard with similar adoption. Ubuntu's system is pretty robust too and if a standardized notation is set then it would be equally easy to compare versions with each other So maybe that can be the standard. In the end what I really want is a system that allows dependency management tools and programmers alike to see at a glance that minor versions may contain breaking changes, similar to how the semantic versioning standard tells us to expect breaking changes with major version. The form of this I don't really care about.

In the end, as long as the version keeps going up instead of down, I'm fine with it. It may be a bit inconvenient but it's like there's a risk to accidentally confuse a new release for an older one.

6

u/2Punx2Furious Aug 21 '20

(YY.MM)

But that's going to break in 80 years. Or sooner, for people who started using it in the 90s.

19

u/Zaneris Aug 21 '20

If your software is around long enough for this to become an issue, I think it would fall under the good problems to have category.

5

u/crabmusket Aug 21 '20

I suspect 20.04 will be out of LTS by the time 2120 rolls around!

0

u/[deleted] Aug 21 '20

[deleted]

3

u/hippydipster Aug 21 '20

Developer: Not my problem!
Aubrey De Gray: We've solved aging!
Developer: Fuck!

2

u/[deleted] Aug 21 '20

[removed] — view removed comment

2

u/2Punx2Furious Aug 21 '20

YYYY would work. At least for the next 8980 years.

2

u/GrandOpener Aug 21 '20

Longer than that actually since no existing software versions predate the mid 1900s.

2

u/GrandOpener Aug 21 '20

I was today years old when I finally learned what that weird .04 at the end of Ubuntu LTS versions means.

→ More replies (1)

25

u/davidpdrsn Aug 21 '20

I wouldn’t say that fixing a bug should require a major version bump.

I don’t remember where but Rust has a document that outlines the kinds of changes that are considered breaking. It explicitly states that fixing soundness bugs isn’t considered a breaking change even though it might require users to change their code.

TS could have done something similar.

8

u/StillNoNumb Aug 21 '20 edited Aug 21 '20

The situation of TS is very different to what Rust does though. Rust has very well-defined sound typing; for every piece of correct code, there is parts of the documentation explaining why it is correct. TypeScript is very different, it's not sound at all and the compiler letting code pass through doesn't mean it's actually correct. Instead, TypeScript helps you by catching as many errors as possible - and with any new release, it might help you find more errors. However, many of these things aren't documented at all, so deciding what's a breaking change is much harder.

For example, take Record<number, string> and Record<0 | 1 | 2, string>. The latter expects a value with ALL three keys (and they're all required): 0, 1, and 2, while the keys in the former are optional (the empty object would work). Special casing like that complicates typing rules by a lot - but it just so turned out to help catch the most errors for the wide variety of code written that uses Record.

Creating a precise specification for such a system while still giving the opportunity to extend it is nearly impossible.

→ More replies (1)

13

u/mycall Aug 21 '20

Chromium does this too.

2

u/dscottboggs Aug 21 '20

no one would pay as much attention to TS releases if we were at v40 already

And this is a bad thing because... marketing?

20

u/epicwisdom Aug 21 '20

Why are you being so reductive? I think it's obvious and natural that anybody developing a project would want to stay relevant.

9

u/langlo94 Aug 21 '20

Yeah marketing is a necessary evil, it doesn't matter how good your product is if nobody ever hears about it.

→ More replies (1)

1

u/BroBroMate Aug 21 '20

That rationale is bollocks, IMO. Is every single bug fix really breaking a public API? I'm highly dubious on that claim.

And if it is, that's fine, use semver properly to communicate that.

11

u/Yehosua Aug 21 '20

For a type-checking compiler in particular, fixing bugs can very easily mean that code that used to compile (because it wasn't using the type system in quite the intended way) no longer works. So it's a breaking change in the sense that it alters publicly observable behavior that code relies on, requiring code changes to continue working.

→ More replies (6)
→ More replies (13)