Hacker News new | ask | show | jobs
by livrem 978 days ago
Even without the time traveling, I would be happy if there was just a single stable, non-bloated, reliable, portable platform that could be used for when you just want to Write Once and then know that it will Run Everywhere _forever_ (* insert disclaimer about nothing literally lasting forever). Not something that rolls out breaking changes every six months. Or six years for that matter. Would not even have to be an entire API, just a clear declaration that a subset of some APIs will never change, and some tool to verify that my code did not accidentally use any of the other parts of the API.

Unfortunately running things in a browser is no guarantee, even for those that would otherwise consider that a good option.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

https://developer.mozilla.org/en-US/docs/Web/HTML/Element#ob...

3 comments

Web browsers are remarkably backwards compatible. 20 year old websites continue to work fine.

The things you linked are only advised against for new code:

> These features are likely stable because removing them will cause backward compatibility issues and break legacy websites. (JavaScript has the design goal of "don't break the web".) Still, they are not cross-platform portable and may not be supported by all analysis tools, so you are advised to not use them [...]

They are also typically browser-specific extensions that were never cross-platform in the first place, features added based on proposals that were not in the end accepted (such as the Object.observe/unobserve API), or features from the Old Times™ before the specs were fully defined (and therefore typically also not cross-platform).

You've also got a bunch of deprecations for things that were in the spec, will almost certainly be supported forever, but are now seen as bad API design for one reason or another - usually because they don't handle edge cases correctly for historical reasons, or the name doesn't reflect what the function actually does. Unless any of these features actively leads to a security issue, they're very unlikely to be removed.

20 year old browsers don’t work at all, though. You can’t browse any of the top 100 sites, and you won’t be able to download an old release of firefox with your old version of internet explorer, because SSL.
Win32 is probably as close as it gets
You can get closer by limiting the depth and breadth of the API, for example by using VT100 and the I/O operations from the C standard library.

That is ‘a bit’ minimalistic, but it is “just a single stable, non-bloated, reliable, portable platform that could be used for when you just want to Write Once and then know that it will Run Everywhere _forever_ […] Would not even have to be an entire API”, and it could run on hardware that has no chance to run Win32.

But it's not cross platform. Unless you count wine.
I'm counting wine
Isn't .NET Core pretty much what you're describing at this point?
I don't have experience with .net core, but working on a cross platform java desktop application has me pretty convinced that "write one, run everywhere" is a pipedream even before you add on "forever". It's maybe more of less fine for small, simple applications, but eventually you'll run into something that doesn't work the same in Windows as in Mac and you'll start having to write platform-specific workarounds. At some point you'll find yourself reflecting into the platform-specific jvm internals to work around some bug or another. Then an os update will break something. Then a jvm update will break something.
I must admit I never looked at that ecosystem. Does it just happen to have been quite stable or is it a serious design decision they made and are sticking to?

From a quick search I do not get the impression that .NET has been deprecating parts of the API, including Core APIs, in the past, e.g.:

https://learn.microsoft.com/en-us/dotnet/core/compatibility/...

.NET was pretty stable. I remember porting old .NET Framework 4.x MVC web app to .NET Core 2, and then to .NET 5. Both times it took less than an hour to port. Old directory structure and APIs still work even if they are not the new hot way to do things. Microsoft is known for backward compatibility.
What UI would you use with it that runs on all platforms?
For desktop, Avalonia, hands down.

https://avaloniaui.net/

Open source, powered by Skia, backed by JetBrains, and quite battle-tested at this point for small to medium-sized apps. In theory perfectly capable for enterprise as well, since it's basically a spiritual successor to WPF, which has been an industry standard for about 15 years.

They're diving into mobile and WASM well, but that's more of a recent effort and I haven't tested that yet.