For the best experience on desktop, install the Chrome extension to track your reading on news.ycombinator.com
Hacker Newsnew | past | comments | ask | show | jobs | submit | history | masklinn's commentsregister

Unions can be used as a somewhat safer (not safe by any means but safer), more flexible, and less error-prone form of transmute. Notably you can use unions to transmute between a large type and a smaller type.

That is essentially the motivation, primarily in the context of FFI where matching C's union behaviour using transmute is tricky and error-prone.


There are rare cases where all attributes of the C union are valid at the same time. Say you have a 32-bit RGBA color value and you want to access the individual 8 bit values. You can make a union of an 32 bit int and a struct that contains 4x 8 bit integers.

Also you can manually tag them and get s.th. more like other high level languages. It will just look ugly.


I assume it's anthropic rejecting the US Government's use of their software for domestic mass surveillance or fully autonomous weapons, and openai happily agreeing to it.

That has led to a significant number of people switching over from openai, or at least stating they were going to do so.


> Downvoting is the tool for items that you think don't belong on the front page.

You can’t downvote submissions. That’s literally not a feature of the site. You can only flag submissions, if you have more that 31 karma.


And flagging is appropriate when you think content is not authentic

Twelve year old account and who knows how much lurking before that and I've never noticed this. Good lord.

Optimistically, I guess I can call myself some sort of live-and-let-live person.


> Yes, it's also a systems language without a runtime. But that's not the novel part.

Low level strong correctness was absolutely a novel part. In fact it’s exactly why many people glommed onto early rust, and why it was lowered on the stack.

Although learnability and weirdness budgets were also extremely novel in low level contexts which had been subsumed by C and C++.

> horrors in C++

Yes, horrors in C++. Half baked jerry-rigged and barely usable nonsense. Not an industrial strength langage with a reliable type system and a strong focus on safety through types.


Memory safety is not the same a scorrectness and more advanced type is also not the same thing as correctness.

50 years of computing have proved pretty conclusively that less than that is wishful thinking at best. Large C++ programs, even with massive amounts of resources and tooling, can’t even get memory management correct.

That Rust gives you correctness is very misleading claim.

> all the correctness

When did OCaml get affine types? Or unique references?



> I imagine Rust has features which can not be translated into Go's assembly

Why would there be? Go’s assembly might be lacking ways to make them optimally efficient, but that’s probably a given either way without an optimizing compiler backend.


> It's similar to how Rust has isize but no fsize.

isize is the type for signed memory offsets, fsize is completely nonsensical.


2018 (tham luang cave rescue) is when the cracks really started showing up, so the trajectory was probably set a while earlier.

The tendency was probably always there given the serial lying about self driving started circa 2015, or the weird ego trip of ousting the founders and getting himself called co-founder, but if we’re looking for a point event the removal of his long time PA in 2014 still stands out to me.


“Sure your software crashes and your machines get owned, but at least they’re not-working very fast!”

Right. This is so often the excuse for terrible designs in C and C++. It's wrong, "But it's faster". No, it's just wrong, only for correct answers does it matter whether you were faster. If just any answer was fine there's no need to write any of this software.

You also need to own the buffer otherwise you’re corrupting someone else’s data, or straight up segfaulting.

As long as you clearly document that the incoming data is going to be modified, it's not a problem. And in a lot of cases, the data either comes from the network or is read from the file - so the buffer is going to be discarded at the end anyway... why not reuse it?

And yes, today it would be easier to make a copy of the data... but remember we are talking about 90's, where RAM is measured in megabytes and your L1 cache may be only 8KB or so.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search:

HN For You