News for hackers. Stuff that matters.
Re:Rust/WinRT Public Preview by blinkingled on Thursday April 30, 2020 @02:47PM (#23034550)
https://github.com/robmikh/minesweeper-rs - I just love how they brilliantly avoided mixing up C++/COM things into this. Tough one to pull when you're dealing with bindings for a foreign language. The code looks fairly standard Rust (except maybe for the winrt::import that looks like Go?).

> If you are familiar with Rust, you will notice this looks far more like Rust than it looks like C++ or C#. Notice the snake_case on module and method names and the ? operator for error propagation.

Developing on and now for Windows just keeps getting better.

Re:Rust/WinRT Public Preview by pathartl on Thursday April 30, 2020 @03:50PM (#23035303)
It seems like they're doing all they can to get developers on their platform. Not to establish Windows developers like they have in the past, but to have others see Windows as just another platform.

We're reaching a revolution from moving from x86 to ARM and I think the more Microsoft positions themselves like this, the less likely they are to be left in some weird compatibility limbo.

As weird as this sounds, I feel more confident with Microsoft being able to do a successful transition to ARM than Apple at this point.

Re:Rust/WinRT Public Preview by pianoben on Thursday April 30, 2020 @05:33PM (#23036412)
In fact, the _have_ transitioned to ARM, way back around the time of the first Surface tablet. Windows and Office have been running on ARM since at least, what, 2012?
Re:Rust/WinRT Public Preview by loeg on Thursday April 30, 2020 @05:44PM (#23036512)
Windows NT in 2000? I guess ARM was not a going concern at the time, but Windows was remarkably portable in 2000 before the dark decade of more or less exclusively Wintel.
Re:Rust/WinRT Public Preview by zrm on Thursday April 30, 2020 @09:46PM (#23038338)
https://archive.org/details/Microsoft_Windows_NT_Server_Vers...

"Disc contains code to run on Windows NT-compatible x86, Pentium, MIPS, R4x00, Alpha, PowerPC and Pentium Pro systems"

Re:Rust/WinRT Public Preview by jupp0r on Thursday April 30, 2020 @09:41PM (#23038309)
Windows itself has never been the problem, but the Software that’s running on it.
Re:Rust/WinRT Public Preview by pnako on Thursday April 30, 2020 @08:36PM (#23037958)
Way before that they had ARM-based Pocket PCs running Windows CE (or Windows Mobile).
Re:Rust/WinRT Public Preview by GordonS on Friday May 01, 2020 @05:40AM (#23040480)
Windows is my daily driver, and I spend most of my time at work these days building dotnet core applications for Linux on both x64 and ARM. It's a great dev experience

Seeing what was coming with cloud and making .NET cross-platform was very well timed.

Re:Rust/WinRT Public Preview by DeathArrow on Friday May 01, 2020 @07:49AM (#23041116)
Microsoft tried countless times to move to Arm.

The most recent efforts are with their Surface Pro X, their SQ1 CPU and pushing Qualcomm to release Snapdragon 8cx CPU for ARM laptops.

But most software development companies didn't care enough to recompile their software for Arm and running X86 software in emulation is not exactly a good experience.

Re:Rust/WinRT Public Preview by VWWHFSfQ on Thursday April 30, 2020 @08:47PM (#23038015)
It will be very difficult until Windows is POSIX-compatible. Whatever that means, I don't know. But it can't just be the Windows Subsystem for Linux. The whole OS needs to have POSIX compatibilities.
Re:Rust/WinRT Public Preview by wongarsu on Thursday April 30, 2020 @09:31PM (#23038243)
Windows NT used to have a POSIX subsystem [1] that applications could use instead of the Win32 subsystem. So the Windows NT kernel is designed with the option of POSIX compatibility. Arguably the Subsystem for Linux is the current successor of the POSIX subsystem, providing POSIX compatible access to the kernel along with a POSIX compatible shell and UNIX commands.

Obviously the Win32 subsystem isn't POSIX compatible, but I'm not sure why we would want that.

1: https://en.wikipedia.org/wiki/Microsoft_POSIX_subsystem

Re:Rust/WinRT Public Preview by jacobush on Friday May 01, 2020 @01:18AM (#23039338)
That subsystem was just so they could tick off the “POSIX” box for Department of Defence.
Re:Rust/WinRT Public Preview by pjmlp on Friday May 01, 2020 @05:06AM (#23040323)
That was one of many, then came SFU, followed by SUA.

GNU/Linux users should be happy that old Microsoft didn't bother to do that much with POSIX subsystem.

Had they actually invested into keeping it up to date, and many of us on PC land would never bothered with FOSS UNIX clones.

Re:Rust/WinRT Public Preview by jacobush on Friday May 01, 2020 @05:14AM (#23040363)
Yeah, that may be true, but on the other hand, had they made it useable, portabilith with other Unix would have been a simpler option.

Simpler than Win32 + Unix portability in any case. Or in some cases, software would have been ported to Win32 at all.

Re:Rust/WinRT Public Preview by pjmlp on Friday May 01, 2020 @08:03AM (#23041185)
What UNIX portability?

Back when I was in the university, and Linux kernel was still at 1.0, I had the pleasure to write C and C++ code across Xenix, DG/UX, Aix, HP-UX, Solaris, BSD and naturally Linux also.

There is POSIX, there is what each OS actually do for the implementation defined behaviours, then the whole set of APIs that made each UNIX variant unique and were the selling point of the UNIX clone to start with.

Autoconf and friends did not start out of masochism.

Re:Rust/WinRT Public Preview by DeathArrow on Friday May 01, 2020 @07:57AM (#23041155)
>Yeah, that may be true, but on the other hand, had they made it useable, portabilith with other Unix would have been a simpler option.

That's not necessarily the case. See macOS which is using different GUI libraries, Metal instead of Vulkan etc.

So you can't recompile macOS apps to use them on Linux.

Re:Rust/WinRT Public Preview by DeathArrow on Friday May 01, 2020 @07:54AM (#23041142)
People forgot that Microsoft was one of the biggest UNIX vendors with Xenix and for a long time, Microsoft had the highest-volume AT&T Unix license.
Re:Rust/WinRT Public Preview by dmitriid on Friday May 01, 2020 @05:10AM (#23040344)
In reality, there are very very few people who care about POSIX compatibility. Because there are no POSIX-compatible systems in the wild.

POSIX-certified systems conform to different POSIX standards. And most of them are of no use to the average developer such as AIX, HP-UX, Solaris.

The rest are largely compatible which means they are not compatible. And yes, that includes every single one of Linux distributions and FreeBSD.

Re:Rust/WinRT Public Preview by DeathArrow on Friday May 01, 2020 @08:09AM (#23041217)
I am beginning to think that while POSIX, Unix and X11 might have been innovative and very useful in the '70s and ' 80s, now they are really old and most of the computing landscape changed.

We need better operating systems metaphors.

Re:Rust/WinRT Public Preview by peatmoss on Thursday April 30, 2020 @10:57PM (#23038651)
How can we bring this to Linux/BSD? Specifically the GUI layer? I’ve lamented that Linux desktop world has been fragmented and alien as compared to other major environments. I used to think that things would have been better if we had chased GNUStep and source compatibility with macOS.

I feel like the non-GUI userland in Linux is best in class and is effectively a given for any server deployment. But all the developers I know cobble together a mediocre Linux-like environment on macOS so they can have a first-class desktop environment and an okay development environment.

On the other hand I read about people using Windows as development environment by using WSL.

I feel like Linux will never organically gain critical mass for a desktop environment—substantial source compatibility with some major platform seems like the way to go. How are the Windows APIs vs the Cocoa APIs these days? Assuming source compatibility could help boost desktop Linux’s fortunes, is Windows or Cocoa a better target? Does consideration of iOS change the calculus?

Re:Rust/WinRT Public Preview by pjmlp on Friday May 01, 2020 @05:03AM (#23040306)
It is already available, it is called GObject, KParts, D-Bus.

If the community has embraced a proper desktop eco-system around them, like the component vendors on other platforms, they aren't going to start now.

I surely don't see job offers for Linux/BSD GUI toolkits as I see for Apple, Microsoft and Google ones.

WSL is only for those that use Windows to target GNU/Linux, the demography that used to buy macOS to do the same.

For traditional Windows developers it doesn't really matter. PowerShell + Windows Terminal is where the action is.

Re:Rust/WinRT Public Preview by elcritch on Friday May 01, 2020 @10:27AM (#23042285)
No, the point of peatmoss's comment is that Linux doesn't lack components or even tools, they lack a cohesive ecosystem. The parts like GOjbect, or KParts, or D-Bus are present but lack cohesion and coordination. The paid teams at Cannonical, IBM/Red Hat, etc all seem to be more concerned with rewriting the core desktop shell's every other release than making a cohesive ecosystem on their chosen tools.

For example, take high DPI. You have two primary competing toolkits between GTK/QT. It took a while but QT/KDE finally added HiDPI. Great, so I could get Hi-DPI setup on KDE! Then I open Firefox and it all falls apart because GTK. Extrapolate to any other number of issues. Unfortunately, Windows 10 isn't much better wrt to HiDPI (at least a couple years back when I last used it). I think there are more different UI toolkits on Windows than Linux has. Counterpoint: MacOS has one global toolkit with message passing based objects, it was almost trivial for Apple to add HiDPI and then dark modes. GNUStep/ObjectiveC would've provided similar basis on Linux, but it never took off. Now macOS is slowly loosing cohesion, instead of ObjectiveC 3.0, they made Swift which from my perspective appears to only be good at adding bugs to the terminal app while trying to avoiding message passing (no more user hot-loadable, un-sactioned third party plugins for any program on macOS :/ ).

At this point, I vaguely dream that HaikuOS will take off or someone makes a WebOS DE for Linux that has a complete suite of tools... but like peatmoss, I'd settle for a Rust/winRT on Linux.

Re:Rust/WinRT Public Preview by peatmoss on Friday May 01, 2020 @02:59PM (#23045366)
Better said than I could do.

One thing I’ve also thought is that if Linux had managed a first-class GNUStep environment with a compelling alternative to macOS in terms of dev tooling, it could have been great leverage in terms of keeping Apple focused on the core developer experience in macOS.

Re:Rust/WinRT Public Preview by derefr on Friday May 01, 2020 @06:57PM (#23047368)
Counterpoint: Windows is an Operating System. macOS is an Operating System. But Linux is not an Operating System†.

Rather, individual distributions of Linux are Operating Systems. As are the other Unices, e.g. the BSDs, Solaris/Illumos, all the old ones like IRIX, etc. And all of those, at first, built their own Desktop Environment from the ground up, just like Windows and macOS did.

As it happens, through the power of FOSS, many of these Desktop Environment projects were gradually merged, or the various distributions dropped their own DE in favor of someone else's.

But the historical path-dependence is still there, and the political lines are still mostly clear.

Don't think of KDE as "a Linux Desktop Environment." It's both not just for Linux (you can run it on FreeBSD, too!) and also isn't available for every Linux distro. KDE is still fundamentally, in some sense, "SUSE's Desktop Environment."

Same with GNOME: it might have been created by GNU, but it was mostly funded by RedHat and IBM for many years, even if Debian et al eventually picked it up as well.

Same with CDE: that's HP's desktop environment.

If you think of each of these companies as providing their own Operating System with a GUI composed solely of the graphical applications written for their own DE, the continued non-merging of these DEs makes a lot more sense. There's no more reason for them to merge with each-other than for them to merge with e.g. Android. (These OSes all happen to be based on Linux, but that doesn't really mean anything. macOS is based on BSD; should the macOS DE therefore merge with some DE that runs on BSD?)

† Defining "Operating System" here as "a software ecosystem that tries to deliver a cohesive user experience to the people who deploy it."

---

The thing that makes POSIX DEs different from the ones on Windows and macOS, is that you can install multiple DEs' libraries, and then run applications from one DE "under" another DE.

Except for special one-off internal provisions for their own legacy DEs (Carbon; WoW) you can't run software written for another DE "directly" on Windows or macOS. You can only virtualize such software using e.g. Wine, or an X11 server that runs as a window under your DE.

But the fact that Linux can do this, doesn't mean that the software was designed with this in mind. There's no "Linux integrated GUI experience" that all these applications are trying to target (FreeDesktop is forum for "meet in the middle" consensus solutions to be generated when required, not a working group for creating an encompassing standard for everyone to converge toward.) There's just the individual Operating Systems' GUI experiences (plural), where a given GUI app will fit in with the OS it was written for—and maybe with any other OS that happens to share its DE as the primary DE that the system is cohered around.

tl;dr: there is no "Linux." There's just RedHat, Debian, Canonical, openSUSE, Slackware, etc. all with their own goals. And also FreeBSD, NetBSD, Illumos, and whatever wacky proprietary Unices are still in play, who all also run and support these same DEs on very different substrates, with their own even-more-different goals. Each corporate player delivers you their own experience. There's no intent, between these companies, to try to commodify that experience into the same experience. Where would these companies/projects be, if they did?

Re:Rust/WinRT Public Preview by fluffything on Friday May 01, 2020 @05:46AM (#23040514)
> WSL is only for those that use Windows to target GNU/Linux, the demography that used to buy macOS to do the same.

Do you know many people that used to do this with macOS and are now using Windows ?

Like, oh boy, I tried, but after 4 months I ended up back with macOS.

Re:Rust/WinRT Public Preview by sfifs on Friday May 01, 2020 @10:18AM (#23042190)
In my experience, one of the the problems is that Macs are hilariously underpowered for many modern dev and analytics use cases. So the workaround is to work off remote machines/clusters over web interfaces/SSH but for many development use cases that's just slow and clunky - the have merit more in productionising. The series of hardware clusterfucks on Mac haven't helped ether.

So I've seen Mac users who work in these areas get sick of the issues and limitations and switch to Win 10 + sometimes WSL.

The people remaining with Macs are executive suite (who go for iPad pros) and account execs who do sales where it looks cool to go pull out a Mac. However even there people are increasingly looking dumb when they want to present something and go on 5 min dongle troubleshooting hunt because Mac killed HDMI and VGA ports and start their presentation appearing incompetent. Sometimes over web screen shares, only the desktop shows and not the applications.

By refusing to focus on hardware/software quality and power users, Apple has lost the game on high end.

Re:Rust/WinRT Public Preview by fluffything on Friday May 01, 2020 @12:44PM (#23043912)
> In my experience, one of the the problems is that Macs are hilariously underpowered for many modern dev and analytics use cases.

This is what I do and works perfectly. My dev machines are 82 cores xeon platinums with Terabytes of RAM or nodes with 8 V100 GPUs attached, etc.

I don't know of any workstation, much less laptop, that could be a replacement for any of that.

For the stuff I do on the laptop itself (Word/Powerpoint/Outlook, web browsing, using an editor to edit files remotely, etc.), more power wouldn't hurt, but my macbook is a macbook air 2013... so I can't imagine that a 2020 macbook would be underpowered.

Re:Rust/WinRT Public Preview by sfifs on Friday May 01, 2020 @01:36PM (#23044515)
Bulk of business analytics and modeling in the world happens in the zone between "regular business laptop" and "82 Core Xeon machines". Laptops with Xeons and reasonably powerful NVIDIA GPUs thrive in that environment.
Re:Rust/WinRT Public Preview by fluffything on Sunday May 03, 2020 @01:09PM (#23060313)
The CPU and GPU is rarely the problem. The problem is the amount of data to analyze. In a laptop with a 1TB SSD, if I need to analyze 200Gbs of data here and there, I just don't have enough hard-disk space, so I need to SSH somewhere anyways. Once you have to do that, then you might just analyze it there. Bringing it to your laptop makes no sense.
Re:Rust/WinRT Public Preview by blinkingled on Friday May 01, 2020 @12:07PM (#23043491)
Few years ago I did this transition - I had a MBP that I used for all Unix based things - after realizing how great Ubuntu runs under Hyper-V I just began to use that. It wasn't as seamless but no big deal opening up SecureCrt to connect. Then WSL came along and I used that but found the file system access to be too slow so back to Hyper-V VM. Now that WSL2 is actually a more seamless Hyper-V VM I am planning to just use that. I truly haven't needed a Mac for anything at least 4 years. I do a bunch of Enterprise Java development along with learning Rust etc. - VSCode with Remote Extension Pack makes it all even better.
Re:Rust/WinRT Public Preview by fluffything on Friday May 01, 2020 @12:43PM (#23043898)
So you switched from a MBP to a Windows laptop ? (its unclear from all that you wrote) What was the advantage ?
Re:Rust/WinRT Public Preview by badsectoracula on Friday May 01, 2020 @05:09AM (#23040335)
IMO the main issue with Linux desktop is that it keeps getting broken. Outside of X11, which itself doesn't provide much in terms of features so you need to implement a ton of things, there is no stable API. Both Gtk and Qt intentionally break backwards compatibility every few years and unintentionally in-between (mainly Gtk though), which means that projects that rely on those waste time on keeping up with the changes instead of adding features and fixing bugs.

And it isn't just Gtk and Qt, outside of a very very small set of libraries (e.g. libcurl and Cairo), most other libraries do the same thing and most developers do not even seem to see that as a problem - except if you sit down and consider how much time is wasted in total by the users of those libraries (ie. the people who would actually make the desktops and the desktop applications) it should be obvious how much of an issue is (and even then, because many programmers prefer theoretically "clean" code and believe that the only way to do that is to rid existing working code and replace it with new -and unknownly broken- code, they have a very strong bias against even trying to accept this).

A very big reason Windows is dominant is because when something lands on the OS itself, chances are you'll be able to use it decades later. macOS much less so, but they have an army of engineers to keep up and even then as time moves on you see many people disliking how macOS breaks things (see the latest 32bit disaster).

Outside of a few influential outliers, like Linus himself or Keith Packard (who works on Xorg and Cairo) there aren't many that care about not breaking things. And IMO it is a bit disconcerting that it seems to be mainly the "old guard" of Linux developers that seem to care about this. I hope this is only because they've been around enough to realize that unnecessarily breaking things isn't a good idea, otherwise we can only expect things to become more broken over time (and Linus had this stance for decades, so it might not have anything to do with wising over the years).

Honestly, the move fast and break things culture that the web has fostered doesn't work for anything that has to do with other stuff people rely on.

But this is most likely also why you do not see that issue as much in the non-GUI world: most of the non-GUI stuff on Linux are either very long running projects (e.g. Bash, Perl, etc) that just do not break or very young projects that are mainly used for web work that will be thrown away in a couple of years or so, so any breakage wont be felt as much (and people working on those are used to broken things anyway). Any exception to that has ramifications that are felt for a long time - see Python2 vs Python3 as an example (...of what not to do - and note how many will even consider such breakage as natural and unavoidable, as if it was some sort of force of nature).

Unless this mentality and culture of breakage changes so that we can build stuff on solid foundations, things wont change.

Re:Rust/WinRT Public Preview by noch on Friday May 01, 2020 @07:47AM (#23041102)
> I feel like Linux will never organically gain critical mass for a desktop environment [...]

Indeed. https://media.ccc.de/v/ASG2018-174-2018_desktop_linux_platfo...

Re:Rust/WinRT Public Preview by mister_hn on Friday May 01, 2020 @09:47AM (#23041928)
Just use Qt binding for Rust and you can have it on Linux.
Re:Rust/WinRT Public Preview by masklinn on Friday May 01, 2020 @07:31AM (#23041020)
> except maybe for the winrt::import that looks like Go?

It looks to be a pretty extensive codegen hook, generating bindings to the referenced runtime components on the fly based on the module metadata it finds on the system.

Apparently the C++ version uses IDL and an explicit codegen step instead: https://docs.microsoft.com/en-us/windows/uwp/cpp-and-winrt-a...

Re:Rust/WinRT Public Preview by steveklabnik on Friday May 01, 2020 @08:59AM (#23041526)
It's a really intriguing approach; most use "build.rs" to do codegen.
Re:Rust/WinRT Public Preview by masklinn on Friday May 01, 2020 @09:34AM (#23041814)
Seems sensible though, the build.rs solution would require every project using rust/winrt to have a build.rs and code to load & codegen the modules (probably copy/pasted), so it'd be a lot more work for users of rust/winrt, though I guess it'd be less magic.
Re:Rust/WinRT Public Preview by steveklabnik on Friday May 01, 2020 @10:05AM (#23042076)
Oh yeah, I agree. I’m really interested to see if this approach would work better than build.rs for some other projects too.
Re:Rust/WinRT Public Preview by ratmice on Friday May 01, 2020 @12:58PM (#23044076)
Hit the max nesting depth, but to reply about why, because winrt::import! is reading (arbitrary?) filesystem paths and there isn't an equivalent for build.rs emitting 'rerun-if-changed'.

So, neither cargo nor the compiler really know of the paths, and cannot accordingly rebuild the sources when they change.

Perhaps they can only change when a corresponding version cargo does know about changes, anyhow, bypassing the build/module system with a proc macro is probably not something to be done lightly.

Re:Rust/WinRT Public Preview by steveklabnik on Friday May 01, 2020 @02:33PM (#23045104)
Fun trick regarding the nesting depth, I believe that if you click on the comment permalink itself, it will still let you reply. Regardless, no worries :)

I was totally forgetting rerun-if-changed! This is indeed a barrier in the general case. I think that it doesn't affect this crate, but I am not 100% sure. Regardless, thank you!

Re:Rust/WinRT Public Preview by ratmice on Friday May 01, 2020 @12:13PM (#23043564)
Bah... This seems like exactly the kind of thing that makes dependency tracking, and sandboxing compilation harder.
Re:Rust/WinRT Public Preview by steveklabnik on Friday May 01, 2020 @12:33PM (#23043776)
Why? I'm not an expert here, but it seems basically the same to me.
Re:Rust/WinRT Public Preview by Koshkin on Thursday April 30, 2020 @04:11PM (#23035521)
> brilliantly avoided mixing up C++/COM

I remember VB6 was also exceptionally good at this.

Re:Rust/WinRT Public Preview by pjmlp on Friday May 01, 2020 @01:29AM (#23039384)
COM is both an evolution of VBX and a subset of OLE 2.0.

.NET was going to be what UWP is now, an evolution of COM, but then Java happened, and they went with something similar instead.

There are some references to how this all happened in the story of F# evolution, given that Don Syme was part of the team since the early days.

Re:Rust/WinRT Public Preview by KeBugCheckEx on Thursday April 30, 2020 @04:43PM (#23035872)
Actually a lot in COM was made to work on vb. COM string type is BSTR which stands for Basic STRing.