Better HN
topnewbestaskshowjobs
Log inSign up

simonask

2,532 karma · joined May 6, 2012 (14y ago) · 854 submissions

Submissions

comment 2d ago · link · parent

Assertions were always an option. Unless I'm missing some new development, contracts are just a new way to spell assertions. That's good, but it doesn't move the needle at all in terms of memory safety.

comment 2d ago · link · parent

Harder to read, easier to understand.

comment 2d ago · link · parent

Sure, but that's just because Apple already did the work, and they only have to support Metal and to a limited extent OpenGL anyway.

On a Windows desktop, you have D3D11 and below, D3D12, Vulkan, and OpenGL. I believe you can do most of it if you're using GDI, but even Microsoft's own myriad of UI frameworks have spotty support.

comment 2d ago · link · parent

It's because it is an unbelievably difficult and quite finicky thing to support, especially if the 3D canvas uses a different rendering API than the UI framework itself.

For example, say your UI is drawn with OpenGL, but you need an embedded Vulkan canvas. This takes a huge amount of API-specific code passing API-foreign texture handles and synchronization objects between contexts. You need to do this for every possible combination of APIs, and it's not symmetrical (hosting Vulkan within OpenGL is different from hosting OpenGL within Vulkan).

Every desktop-class rendering API does have extensions for dealing with foreign APIs, but it's a lot of work, to the point where rendering into shared memory from a subprocess is sometimes the most viable option.

comment 3d ago · link · parent

I hate this. We have a whole operating system doing its absolute best to prioritize hardware resources. Don't be out here throttling yourself.

Especially for something like compiling shaders. It literally never happens unless the user is about to go play a game, which is going to consume most resources anyway. To the user, there's nothing more important running right now.

comment 4d ago · link · parent

The upside is that I never get any spam or scammers on Signal, like we see on all other messaging platforms.

Maybe it's just because it's less widespread where I am, but nevertheless.

comment 6d ago · link · parent

I'm European. Describing the Republican Party as "a party [I] don't like" is unbelievably out of touch. The entire world outside of the US sees and says plainly what's happening. And yeah, seen from the outside, the US justice system sure does seem broken in a number of ways.

comment 6d ago · link · parent

> Why did you publish anything, if you didn't want it to be used by third parties?

Because 3 years ago, everyone had a reasonable expectation that any publicly available work would be appropriately credited and/or compensated for, in accordance with both copyright law and open source software licenses.

You realize that even very permissive software licenses, like MIT or Apache-2.0, still require attribution? Now a few companies are making big bucks selling your ideas (and sometimes verbatim code) without adhering to the terms of that license.

The social contract is utterly broken. The legal situation is utterly questionable. The only reason they get away with it is that the inmates are in charge of the asylum in the US.

comment 1w ago · link · parent

> And some people have a worldview that says wealth is a zero-sum game, therefore anyone rich must have gotten that wealth by exploiting the poor.

Wealth is not zero-sum, but it is created by work. When you collect a salary in exchange for work, it is because your employer deems that your work is worth more than your salary. Otherwise, it would not be a sound financial decision to employ you. There is literally no way to rise to the top without paying people less than you think their work is worth.

When many thousands of people create value in exchange for less money than their work is worth, that's how you get a billionaire.

You might say, "well it's your choice to work", but under capitalism, donating the surplus value of your work to an richer person is the only way to survive. As in, you will literally die if you don't. If you can somehow collect the required capital to start a company, you can try to compete, but now you're donating your surplus value to billionaire investors instead, and with much fewer protections. If you succeed, you are now the one depending on thousands of workers donating the surplus value of their work to you, and the cycle repeats.

The only way to break the cycle is to keep the coordination of many humans, but forgo the upwards flow of wealth to a few individuals. We used to do this with taxes, and it's a crude mechanism, but it worked. Collective ownership seems to work even better.

comment 1w ago · link · parent

Wait, so you believe that unless the program's behavior is described by an ISO standard document, bugs cannot exist?

"It's a feature, not a bug!" taken to the next level. I guess I admire your dedication to obstructing reasonable discourse.

comment 1w ago · link · parent

You did move the goal posts, though. Go famously has no protection against data races within the same process, leading to Undefined Behavior.

Why did you start talking about multiple processes? That's a much less common way to do concurrency these days.

Process-shared memory is an OS-specific feature with wildly diverging semantics, and it's not possible to write a memory-safe portable abstraction over that in any language. Windows comes the closest with mandatory file locking. On Linux there's nothing you can do but pray. Hence, `mmap()` is fundamentally unsafe in Rust, and that's perfectly fine.

comment 1w ago · link · parent

Haskell has existed for a long time, yet never had a breakthrough. When I learnt it 20 years ago, it was basically the same as it is now.

It's a great language, but it's a research language. Had it been suitable for the types of projects that get written in Rust or C++ (and it very definitely isn't), people would have adopted it a long time ago.

I know that there is a bit of persecution complex among haskellers, and I'm sympathetic, but perhaps it's worth looking at the practicalities before drawing conclusions. As a craftsperson, I'm not extremely interested in whatever interesting monads you can come up with, when there are lazily evaluated O(n^2) bombs hiding under the carpet.

comment 1w ago · link · parent

> Additionally those toxic vocal evangelists keep forgetting that without C++ there is no Rust compiler.

You say "vocal", yet they remain eerily silent in this and every other thread about Rust on HN, as well as /r/rust over on Reddit.

If you didn't know better, you could almost think they were imaginary.

You seem to have a mental picture of a raging Toxic Rust Evangelist consumed by shame and rage over Rust's Dark Secret: It's using the best codegen backend on the planet (with a compatible license), LLVM, which is written in - gasp - C++!! Dun dun dunnnn!

What a dramatic plot twist! I understand how that might feel very engaging.

The boring truth is that everybody is pretty fine with LLVM, because no reasonable (or real) person believes that this is a problem. As long as it generates pretty decent code in a reasonable amount of time for all the important architectures, it's a great choice.

We're trying to get work done.

comment 1w ago · link · parent

I skimmed the topic. This is a forum post seemingly asking an honest if ill-informed question, and it seemed to foster an interesting and informative debate about why Qt isn't a good candidate for being rewritten in Rust.

I didn't notice any toxicity from either side at all, though admittedly I did just skim.

comment 1w ago · link · parent

> There are many documented cases where it does not work, and there is an active project to change its design so it works in more cases.

Are you referring to the implementation or the model? Because there are several bugs in the implementation, but they are very clearly bugs.

If you're aware of any actual holes in the type system as it is designed, I think the Rust lang team would be very interested in hearing about your paper!

comment 1w ago · link · parent

What absurd nonsense. That's not how anything works.

If it were true, every bugfix would be a breaking change. It's clearly not.

comment 1w ago · link · parent

This is such a deep topic with literally decades of discourse behind it.

I tend to agree with the general principle that panicking or throwing an exception should terminate the process in most cases. But those last microseconds of a process' lifetime matter quite a lot: Are you able to save the user's work? Are you able to log the error so the crash can be diagnosed?

With Undefined Behavior in the picture, you cannot do anything. The whole process is toast, and its entire memory state is invalid.

comment 1w ago · link · parent

> I'm on your side of this, but there are Rust zealots out there and they're incredibly annoying.

I mean, I keep hearing about them, and they just literally never show up anywhere I am, and I'm pretty active in the Rust community.

comment 1w ago · link · parent

Calling it "vibes" is just so unserious.

If you would like the Rust language to have a formal specification, I would suggest you look at ways to help that happen. There is already the Ferrocene[1] project.

The safety model of Rust is extremely well described in detail. It's not particularly hard to understand, either. Are you worried that there is some kind of fundamental flaw in the design, we're just waiting to discover it, and it will all come crumbling down? My suggestion would be to start by understanding Rust's type system and why it works the way it does, and you will very quickly build an intuition ("vibes") that it obviously works.

[1]: https://ferrocene.dev/

comment 1w ago · link · parent

You're pointing out that there can exist a language other that Rust that is even safer, and prevents even more classes of bugs. That's trivially true, of course, but this language doesn't currently exist.

comment 1w ago · link · parent

Who, exactly?

It has been known for decades that GC was one way to achieve memory safety. That was one of the main selling point of Java back in the 90s - no more segfaults.

Rust was an absolute breakthrough, because it provides a second way to gain memory safety, this time without the significant drawbacks of a garbage collector, bringing memory safety to systems programming. That's materially different.

The only other previous attempt at this was Ada, which for a variety of reasons never quite fit the bill despite its obvious strengths.

comment 1w ago · link · parent

I can't be defending the statements of whoever says this, but I do think that the reasonable way to understand it is that the fundamental model that the Rust compiler and standard library attempt to implement is safe and correct by construction, rather than as a statement about the concrete implementation.

Among software developers, we shouldn't need to provide a "assuming there are no bugs" caveat with every statement about how something works, because we know that bugs are essentially unavoidable at scale. We can say that Rust makes it much easier to avoid bugs, but nobody serious has ever claimed that they are 100% eliminated.

It's not like C or C++ compilers are bug free either, despite implementing much weaker models.

comment 1w ago · link · parent

Why would you think that? Bugs exist in complex software no matter how hard you try, including software written in Rust such as the Rust compiler and standard library. Did you expect the highly competent people working on these projects to just one-shot everything?

comment 1w ago · link · parent

Just because emotions seem to be always boiling whenever Rust is mentioned, I want to clarify for people who only follow casually that there is nothing unusual or scandalous about these finds.

The Rust project as a whole currently has 178 open issues with the tag I-unsound[1]. Many of these describe issues that only exist in the nightly compiler, of course, but it does happen that bugs are not caught before shipping. That's software.

[1]: https://github.com/rust-lang/rust/issues?q=is%3Aissue+state%...

comment 1w ago · link · parent

The fact that you will spend any energy at all “flaming” volunteers donating their time to free software is as baffling as it is cruel.

Though I suppose both Microsoft and Apple are happy to receive your unpaid aid with stuffing their bottom lines.

comment 1w ago · link · parent

Isn't that exactly what they're saying?

Some people (not its creators) talk about Zig as if it's anywhere near production ready. It's fine to be excited about it (there's a lot to be excited about), but we gotta be realistic.

comment 1w ago · link · parent

You stumbled upon my pet peeve.

Both C and C++ have a much steeper learning curve than many realize, just because the compilers let you get away with doing things that are fundamentally invalid (Undefined Behavior). Rust isn't actually much stricter, it just catches these problems at compile time.

Anyone capable of writing actually correct, standard-conforming C and C++ is mostly able to first-try the equivalent Rust code in almost all cases, because they are already thinking the same way that Rust requires you to think.

However, a significant portion of people who write both C and C++ don't realize that their code is full of UB - or worse, they don't care.

From a language perspective, the only new restriction in Rust compared to C++ is that mutable borrows (references) cannot overlap. Good C++ programmers are already avoiding this at all cost, because it's a mess to keep track of. When you actually do need it, Rust gives you the tools to build a safe abstraction.

EDIT: And to add, Rust is actually less restrictive in a few areas compared to C++. For example, Rust allows bitcasting between unrelated but compatible types (without going through char pointers).

comment 1w ago · link · parent

These numbers are totally insane. I've never seen a Rust project with a build cache this large.

Do you have 10 different versions of Tokio included in your project or something?

The project I'm currently working on is quite large, and it's locally cross-compiled to 5 different arch/OS combinations, plus a debug build for the local machine. The build dir is 9.1 GB. I've seen it grow to somewhere around 20 GB, but only after a significant number of dependencies were updated, or the compiler version changed.

A clean debug build of Bevy (a game engine, one of the largest Rust projects around) produces a target dir of around 13 GB. By the way, rebuilding Bevy on my machine takes about 1 minute.

Now, these numbers are still much bigger than I would have preferred, but 329 GB? Get out of here.

comment 1w ago · link · parent

Yeah. But also, let’s zoom out: giant unmaintainable insta-legacy abominations are well within the capacity of humans to create - just look at the past many decades of software in general.

The hard part never was writing the code.

The hard part was always to manage complexity in a changing environment.

comment 1w ago · link · parent

> But people happily trust unknown packages in NPM.

I mean... I don't, and I don't think anybody should.

> It's a matter of culture and consensus.

Yeah, but I do think trust, confidence, personal reliability are key factors here. Slop wasn't invented by AIs. We used to call them "script kiddies" - people who only knew how to copy and paste.

> but you can feel when there's care in a project.

I couldn't agree more! This is such an important point.

12345
29