Better HN
topnewbestaskshowjobs
Log inSign up

tialaramex

33,194 karma · joined Oct 22, 2016 (10y ago) · 12,383 submissions

Submissions

comment 5h ago · link · parent

If society is going to be a Black Mirror episode, you'd hope it could be at least San Junipero, or if that's too much to ask, maybe Nosedive or Crocodile or something, those societies are... not ideal but I can live with it.

But no, people seem to be deliberately creating Metalhead or something equally terrible.

comment 6h ago · link · parent

Yeah. That seemed like a reasonable bet and then Russinovich showed that (a) yep that's what is going on and (b) Windows had a thread which exists solely to detect that you're changing these settings and stop you.

The existence of Linux made it obvious that the mid-90s yapping, not just from Microsoft but also some Unix vendors, about how the "server" is special and needs entirely different software is bullshit.

Microsoft's plan at that time was that NT is going to be cheaper to make than the then popular server brands but priced similarly. You've budgeted $5000 for a "server" for your business, there are bunch of options and $4000 worth of PC plus a $1000 NT Server OS license fits the budget. You already know Windows, so that's a plus. But a $50 Red Hat CD with the same PC leaves you with $950.

Russinovich helped silence all the people who'd have insisted that you should spend the extra $950 for a "real" server instead of this free Linux thing.

comment 9h ago · link · parent

I think Rust's choice here is excellent, but lets take a type I've been spending a lot of time looking at recently: VecDeque<T,A> a double-ended queue (hence deque) of T

The natural representation of VecDeque<T,A> would be a thin pointer and three pointer-sized integers, on a modern PC that's 32 bytes.

And sure enough Rust's VecDeque<T,A> is in fact a 32 byte type. But there are indeed layers of abstraction:

VecDeque<T,A> is a WrappedIndex named head, an integer named len and a RawVec<T,A>

RawVec<T,A> is a RawVecInner<A> and a PhantomData<T> marker

The PhantomData is just the idea of T, and evaporates - it doesn't need any space but if you want to get angry about abstractions an evaporating type which makes the compiler work is exasperating.

RawVecInner<A> is that thin pointer, a Cap and the Allocator A. The Global allocator will also evaporate - although some customer allocators might take space here.

Cap, like WrappedIndex is "just" an integer and all the associated code to use that integer properly everywhere and not make clumsy mistakes.

Now, when you use VecDeque you don't care about any of this. It just works properly, and it's no bigger than it would be if it didn't have all this sophisticated machinery inside it, but if you are bothered just by the idea then that's going to drive you away from Rust (or indeed any modern language).

comment 11h ago · link · parent

> When will Rust stop using LLVM and GCC, written in C++?

Actually I think the more likely path forward is that compiler teams move gradually to Rust.

comment 13h ago · link · parent

> Nope that's incorrect.

https://rust.godbolt.org/z/nxnazs7Y6

c and d are both integers. Do you agree?

When you follow this link they'll have arbitrary values so I can't predict what those values will be but I can tell you that they'll be identical because the optimising compiler put both those unused temporary locals in the same spot on the stack.

One and three are booleans which ask whether the pointers to those temporaries are the same, LLVM says they are not even though Rust's policy is that they are. That's not great, but we could choose to imagine that's a Rust bug, except...

Two is another boolean asking whether the integers c and d are the same. LLVM says that those aren't the same either. It has given provenance to integers, that's the bug.

comment 1d ago · link · parent

> If I'm getting what you mean correctly, that's not true

Well, what I'm doing here is describing the real situation with LLVM. If by "that's not true" you mean "that would be a bug in LLVM" then, uh, yeah, we know that it's a bug in LLVM. The LLVM maintainers know it's a bug in LLVM, have for many years.

> Integers do not have provenance

No, integers shouldn't have provenance. Due to this compiler bug unfortunately we can give integers provenance and blow up the world. Remembering the difference between what is and what should be is important, most especially in Criminal Justice.

So as to not rag specifically on LLVM, here's a ticket with Martin in the comments where somebody blew up GNU's C compiler on essentially the same trick question:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119472

comment 1d ago · link · parent

It's true that Rust gives confidence to do (some) crazy pointer tricks which would work in the "pointers are just integers" world, yet not pay the performance price such tricks would cost if we really did "pointers are just integers"

My favourite example is ColdString, a value the same size as a thin pointer and which could be pointing at some text on the heap - but for smaller texts it is actually inline UTF-8 encoded text, the author originally wrote this to rely on the scary Exposure rules and I asked them if it couldn't be Strict instead and instead of "If you're so smart why don't you do it then?" they just fixed it. Nice. Huge fan of ColdString.

However, there are extant examples where you can just trick LLVM into asserting that two integers a,b are different and then showing that a - b == 0 which proves it was lying, those are by definition miscompilations and they don't rely on Exposure, they're just getting the LLVM optimiser to apply a pointer provenance optimisation to a thing it was just told is not a pointer.

comment 1d ago · link · parent

Do you have a particular suggestion of a "not broken" C compiler? Genuinely interested.

comment 1d ago · link · parent

WG14 (the standards committee for the C programming language) does not agree with you.

https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_260.htm

comment 1d ago · link · parent

Quite some time after this blog was written Aria blogged about the "strict provenance experiment" for Rust, and today Aria's API (more or less) is sanctioned and Rust is defined to deliver the behaviour Aria described in the Tower of Weakenings.

Here's the Rust documentation: https://doc.rust-lang.org/std/ptr/index.html#strict-provenan...

So in Rust much of this is spelled out today, although of course the LLVM backend still miscompiles some programs (in Rust or indeed in C or C++) because it can be tricked into giving integers provenance even though that's clearly not what anybody wanted. Oops.

However in C, which most of the examples are written in, the status is a bit less clear. Martin Uecker (who can often be found here in HN's comments) and colleagues wrote a document for ISO but that document is not (yet?) part of the ISO C standard itself. Of course in practice compilers like LLVM, GCC and MSVC need to do what the document says instead of making it up as they go, or else this matters very little.

One thing which cannot be in doubt in any of these close-to-the-metal languages today, almost certainly including obscure ones you've maybe taken a shine to like Odin or Hare, is that provenance is a thing, if you're sure you don't have pointer provenance in your languages but you do have actual pointers, check with a stop watch. If your programs in that language are very slow you might be right.

Because that's why this became a thing. Without provenance, pointers strangle many "obvious" optimisations. Add provenance and now these optimisations are available and your programs go much faster. It's a bargain - albeit one you probably never signed up for as a programmer.

comment 1d ago · link · parent

Building from scratch results in extra incompatibility. Electrifying existing routes would reduce incompatibility.

Today if the railway near me were say, blocked by fallen trees, the alternative route needs:

1. A driver with route knowledge for the alternative 2. A guard with the same route knowledge (this is due to "Ding Ding and Away") 3. A train all of which can run on the nearby non-electrified line.

Missing any of those three? Two bad, your service is blocked here, passengers will need to disembark and use a different method to reach their destination, even though that method might be a train.

Electrification would fix (3). Similarly upgrading to a higher ETCS (ETCS level 0 is basically the absence of ETCS and just indicates that the train has manual controls you could use to drive it without ETCS) would fix 1 and 2, modulo exciting Union negotiations.

In the real world parts of a rail network fail, and a single coherent integrated network is best able to cope with this as you work to fix the issue. For HS1 realistically the vast majority of issues make it useless anyway, you can't go via an alternative route if the tunnel is shut for example. But that won't be true for other new lines.

Edited: Throughout s/ECTS/ETCS/g

comment 2d ago · link · parent

The Democrats just won control of both houses, so for the next two years the insistence will be that problems are caused by Congressional Democrats and most importantly by their profligate spending and refusal to address the deficit which somehow increased massively since it was last important...

comment 2d ago · link · parent

Your thinking is that somehow the EU caused Vladimir Putin to invade Ukraine and Donald Trump to start a war on Iran ?

comment 2d ago · link · parent

Great Britain is small. Its existing systems can do 125mph, which means you can travel to most of the country in a few hours, which is fine. The low hanging fruit would be electrification of existing routes. But "We electrified this section of railway" is boring. Maybe locals notice their trains are nicer and the air is a bit better, operators see reduced costs, in a few cases services are diverted towards newly available alternative stations, but mostly it's just boring effective policy. Yawn.

However if politicians make a new railway you achieve almost nothing but there's a fancy opening ceremony and maybe their name goes on a plaque and it's on the TV news that evening. Hooray for them.

comment 2d ago · link · parent

> For one, natural gas is still cheap

In the US, which produces a whole bunch of natural gas, it is merely more expensive than usual, and so if you're not really tuned in to "normal" I can see you imagining that's cheap - but in the EU it's already at "Russia invades Ukraine" prices.

https://tradingeconomics.com/commodity/eu-natural-gas (check e.g. 10 years to see the longer picture)

In much of Europe (notably the UK, which isn't included in that EU number but is even more affected because it's a major net importer with little inventory) the price of natural gas drives the marginal price of electricity, causing wholesale electricity prices to soar, which then results in retail electricity prices following.

Right now the wholesale price is £220 per MWh. That's 22p per kWh in terms of your retail electricity before any taxes, service charges, network charges or any of the other elements which usually double the final bill.

The right will insist these charges are somehow not caused by the 13GW of gas turbines running on that expensive gas we just mentioned, somehow the price has exploded coincidentally as a result of say solar panels or "windmills". Even their natural audience doesn't really buy this any more, it's so transparently bullshit.

comment 2d ago · link · parent

> virtue signaling

Seems like just virtue to me. The guy who volunteers every week to pick up garbage from the beach isn't virtue signalling, he's just virtuous. The guy who came once, with a film crew and left once they'd got the shots they wanted - that is virtue signalling. They're both shown in the film, but only one of them actually does the signalled virtuous activity when the cameras aren't rolling.

You could argue that RIIR was conducted as virtue signalling if what we saw was one of those translations smeared in unexplained unsafe blocks, with rats nest logic that no human is going to untangle. But that doesn't seem to be the case here.

comment 2d ago · link · parent

> before 1.5 degrees is inevitable

You're expecting people to get working time travel from LLMs ?

comment 2d ago · link · parent

Note that this strategy only works if 5% of your software is the problem - because of Amdahl's law.

comment 2d ago · link · parent

In this particular topic (performance) Rust matters because it will deliver excellent performance. You could write a container -> map -> map -> container flow in fifty memory safe languages, but probably it would be a bit slower than the nasty hack you'd write in C to convert the data in place. Rust isn't, if you're intrigued you will discover that Rust 1) figured out that the two containers must be the same size in memory so it can re-use the original container and 2) did the in-place conversion even though that wasn't what you wrote, because it's faster.

So magically the Rust was just as fast, but much more readable and when a junior (or an LLM) modifies it slightly so that the output container is bigger it won't suddenly segfault due to that scary in-place conversion loop now being a bounds miss, the Rust won't attempt the in-place conversion now that it can't work.

comment 3d ago · link · parent

Sure, you probably shouldn't care about his opinions. He got lucky and like too many lucky people he's chosen to believe that was skill.

comment 5d ago · link · parent

Java's String::toUpperCase appears to be quite a lot more complicated than the Rust but it is at least all Java and thus without careful inspection I can assume it's memory safe.

comment 5d ago · link · parent

> PPS The Java memory model is just superior to Rust's in every way...deal with it.

I don't see it. In Safe Rust we can't write a Data Race so we get SC/DRF because we know we don't have a data race. If we write unsafe Rust we do need to be careful not to break the rules and introduce a data race.

In Java we do not get such a promise at all, just the SC/DRF proof, any of our code might race. However, if we do lose Sequential Consistency we still have defined behaviour, we probably no longer understand how our program behaves (if it's not trivial) but we can say e.g. "I didn't write any code to delete the database" and so conclude it doesn't delete the database.

This doesn't seem like a clean win. I can see valuing either proposition more, but "in every way" I don't get that.

comment 5d ago · link · parent

> When the Rust end-user gets that nice Iterator, someone behind the scenes has to decode the string and decide how many bytes the new Iterator has.

The Iterator doesn't have bytes in it, we're not idiots, the Iterator is over Rust's char type, a Unicode scalar value (a "character" if you don't know the lingo)

What's delivering value here is division of responsibility. Cutting a problem up into pieces each of which can be tackled by an expert. Uppercasing text, encoding characters as bytes, allocating memory, appending to a buffer, these are all distinct problems which a different expert can solve properly.

In that Ruby code you need to gather maybe a half dozen experts to agree how to write this function. Or, of course, one expert YOLOs the rest of it because every topic we don't know much about is easy, right...

Rust does this division a lot. You as a programmer see String but when your String grows that's not code in String where people who know about Unicode live, that's RawVecInner<A> and that code doesn't even know about characters or strings or any such thing, it just allocates enough space to store data.

comment 5d ago · link · parent

Lets compare what's inside this Ruby bug, a C function rb_str_casemap which is 40-50 lines of C fiddling with pointers and calling into macros that presumably are familiar to Ruby developers but opaque to an outside viewer. Is it fixed? I guess so but I can't see very well to be sure, it was counting stuff before and now it is being more careful, I hope it's correct this time.

... against str::to_uppercase the Rust function which has a single line of unsafe code, with a two line rationale provided to explain why it's OK to do this. As a subject matter expert I agree with the rationale. LGTM.

Edited: We're talking about uppercase, they're basically mirrors, but we should choose the uppercase function.

comment 5d ago · link · parent

We know LLVM has miscompilation bugs. Sometimes it is practical for Rust to fix those bugs and so it carries patches for LLVM, but in some cases LLVM IR semantics are just incoherent nonsense. An example of the former (Rust carries patches): LLVM got confused about discriminants when Rust uses niches, when the niche bit pattern used was usually right next to the legitimate values for a type the bug in LLVM caused little notice, it could corrupt data but probably not. However Rust changed which bit patterns to prefer here, so e.g. None for Option<char> went from 0x0011_0000 to the bit pattern 0xFFFF_FFFF and now that same LLVM bug caused crashes as values which had previously been very slightly wrong were instead hugely wrong.

For an example of the latter (LLVM is just nonsense): LLVM still today has a bug found years ago where pointer provenance (a legitimate but hard to think about idea for optimising compilers) accidentally leaks into integers, and so LLVM can end up with two integers a, b which it believes are not equal and yet a - b == 0. Boom.

comment 5d ago · link · parent

Yeah, no. C++ is deliberately wrong about lots of things. You don't have to be wrong, choosing not to be wrong isn't somehow hiding the wrong behind a curtain.

If you try to do the same mistake in Rust it does not compile, this function takes an int (obviously shouldn't but that's a different design bug in C not C++) and we have a wchat_t which is not an int, so that does not compile at all. Footgun removed.

When you start trying to figure out how to write the equivalent mistake in Rust properly, you discover that Rust says uppercasing or lowercasing arbitrary Unicode char values gets you an Iterator and you can't convince your compiler that this cannot make the string longer -- because in fact it might make the string longer. The mistake is averted by design.

comment 1w ago · link · parent

I automatically get text messages if my line goes down, the first two messages after the power went out were 1. ISP "Hey, your line is down" and then 2. Power company "We are aware that your area may be affected by a fault and we are investigating, you don't need to call us to tell us about it. Here's a link where you can see the current status of this incident."

But that ISP text message doesn't care why my line went down. I could have guessed that after power was restored and I didn't get a "You are back online" text that meant a problem but I confess to not thinking about it until I returned home and found that although my power was back my Internet was not.

comment 1w ago · link · parent

Service. What I most value from my service provider is that I can get answers from them without being treated like a baby.

Last time I called my ISP (last year? the year before? I don't remember) I was wondering when I would get service back. The street had exploded, underground power cable threw a tantrum and tore a big hole in the road, the grid company come out and fixed that but then of course my Internet didn't come back once the lights did.

The person who answered my call:

+ Did not waste my time asking that I restart laptops, routers, etc. the diagnostic lights on the router indicate No signal => not a problem I can fix by rebooting things.

+ Without needing me to re-specify where I live went straight to the identified problem (DSLAM offline) and to the fault report (to last mile provider for a failed DSLAM) and told me that in their experience I should expect a fix on Sunday (it was Friday evening). Which is what happened.

comment 1w ago · link · parent

Could we fix that do you think?

I think 25 years ago I would not have believed we would ever fix (La)TeX but here's Typst.

comment 1w ago · link · parent

Essentially the same byproduct to that from making beer (because if you think about it, that's the same chemistry). It is fed to animals. Proponents will insist that they can make it into food for humans but notice - this byproduct has existed for as long as beer - if humans were likely to eat this I think they'd already be doing that long ago, not waiting to discover they love "corn ethanol byproduct" until after they've invented chocolate and pizza...
12345
413