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

478

u/lanzaio Aug 20 '20

Mind boggling. I have no idea why they think it makes sense to treat version numbers as decimals... just call it version 40.

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".

→ More replies (4)
→ More replies (12)

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.

→ More replies (2)
→ More replies (26)

127

u/Poltras Aug 20 '20

Microsoft has a weird history with version numbers... Windows 9 would have broken a LOT of backward compatibility because people did version[0] == '9' to check if you were running Windows 95/98... So they skipped it for Windows 10.

76

u/[deleted] Aug 20 '20

[removed] — view removed comment

60

u/delorean225 Aug 20 '20

Frankly, Windows 10 deciding to jump everything to the same round number at once seems good to me. Sort of a reset.

20

u/DHermit Aug 21 '20

Yeah, skipping numbers is no big deal. At least the numbers increase strictly monotonically.

→ More replies (1)
→ More replies (2)

138

u/[deleted] Aug 20 '20 edited Aug 20 '20

That's an anecdote, ironically originated from another reddit comment.

Windows 95 and 98 reported itself as 3.95 and 3.98 to remain backwards compatible with windows 3 apps. So that prefix check never would have worked.

98

u/kevincox_ca Aug 20 '20

version[2] == '9'

Checkmate.

26

u/everythingiscausal Aug 20 '20

But now you’ve got an index out of range bug on Windows 10!

31

u/kevincox_ca Aug 20 '20

I believe you mean Windows 3.10 🤓👈

(Also assuming a c-string you would get the null byte so perfectly safe anyways)

→ More replies (1)
→ More replies (2)

56

u/sparr Aug 20 '20

Here's some code from the Jenkins CI project (one of their official plugins, to be precise) that would have thrown an assertion for "windows 9" (which wouldn't have had a version starting with "4.1"), and when assertions were disabled would have identified it as windows 98.

https://issues.jenkins-ci.org/secure/attachment/18777/PlatformDetailsTask.java

        if (name.startsWith("windows")) {
            name = "windows";
            if (name.startsWith("windows 9")) {
                if (version.startsWith("4.0")) {
                    version = "95";
                } else if (version.startsWith("4.9")) {
                    version = "me";
                } else {
                    assert version.startsWith("4.1");
                    version = "98";
                }

0

u/[deleted] Aug 20 '20

[deleted]

47

u/funguyshroom Aug 20 '20

Congrats, you found a bug in an 11-16 year old piece of code

→ More replies (1)

18

u/sparr Aug 20 '20

Good catch. I had not noticed that. I agree, it looks like that bug overrides the one I was pointing out :)

14

u/AboutHelpTools3 Aug 21 '20

When a bug saves you from another bug.

→ More replies (1)
→ More replies (1)

24

u/herpington Aug 20 '20

That is one ugly OS version detection.

→ More replies (1)

13

u/chylex Aug 20 '20

The original anecdote was startsWith("Windows 9"), and if you search for that you will find real code that uses this to check for Windows 9x.

→ More replies (17)

19

u/ProgramTheWorld Aug 20 '20 edited Aug 20 '20

I’ve seen this explanation floating around the Internet a lot. Is that the official rationale from Microsoft or is that just speculation? The version number of Windows 95 is 4.0 and Windows 10 is 10.0, so it doesn’t seem right to me.

→ More replies (1)
→ More replies (21)

28

u/BlueShell7 Aug 20 '20

There's a lot of people scared of high version numbers (always hot topic under FF and Chrome releases).

22

u/[deleted] Aug 20 '20

So you just put an arbitrary dot in the middle and that fixes it?

26

u/BlueShell7 Aug 20 '20

Weirdly for some people yes.

→ More replies (1)
→ More replies (5)
→ More replies (3)