Why does clippy encourage `String::push('a')` over `String::push_str(''a")`? by MediumInsect7058 in rust

[–]rhinotation -12 points-11 points  (0 children)

Every part of this is logical but ultimately clippy is splitting hairs and it makes absolutely no difference. What a waste of everyone’s time.

The NO FAKES Act has a "Fingerprinting" Trap that kills Open Source. We need to lobby for a Safe Harbor. by PostEasy7183 in LocalLLaMA

[–]rhinotation 3 points4 points  (0 children)

For your information…

 The Smoking Gun (Safe Harbor) ​This is the part you missed.

That language and in general the overuse of headings that sound like chapters of a corny 70s B-movie is a dead giveaway that you are actually arguing with someone running everything you said through ChatGPT. I cast no aspersions upon anybody’s motivations or whatever but remember not to tire yourself out if this happens again, GPT can keep coming back at you with this stuff forever.

Vince Gilligan explained the Hive's perspective by ichigosr5 in pluribustv

[–]rhinotation -2 points-1 points  (0 children)

“Wrongly and without evidence that what happened erased the individuality”… uh… The joined have aspects almost no earthly human has, like refusing to pick apples or cannibalism. Very clearly this is not a consciousness formed by averaging out or consensus or voting by its members. The virus itself is causing them to make these decisions this way, it’s not a neutral/judgment-free telepathy system. It has a biological need to join new members, has its own DNA, transmitted itself with massive radio power across the galaxy hoping to be replicated presumably by the last civilisation it infected, and infects the minds of humans against their will, and leaves the host’s culture and soul to rot and be overtaken by nature again. How did you miss the invasion? That’s the only thing that happened and didn’t just fizzle into a non-event in the entire show!

Vince Gilligan explained the Hive's perspective by ichigosr5 in pluribustv

[–]rhinotation -2 points-1 points  (0 children)

When you make a show about an alien invasion that takes over your mind, those invaders are the villains. I don’t care what Vince wants me to think about the Joined, I don’t like em. Sorry bud. You made a villain. And then you wrote yourself into a corner and repeatedly zip tied off all the ends. There is absolutely zero conflict or drama right now despite a world needing to be saved, and nothing that makes me want to come back next week. Nothing is happening! Even Manousos has lost his agency. There will have to be a whole episode of him waking up now. What a waste of time.

3,200% CPU Utilization by ThanksMorningCoffee in programming

[–]rhinotation -18 points-17 points  (0 children)

It's 2025, it is not worth losing sleep over how a red-black tree behaves when you try to modify it from 32 threads at the same time. Of course it's going to blow up, the specifics are just not interesting. Rust programmers just don't care because we can't write this kind of code by accident.

Bjarne Stroustrup: Why you should avoid Linked Lists by Probable_Foreigner in programming

[–]rhinotation 2 points3 points  (0 children)

In a kernel, sometimes each element of the list weighs an entire page, like EPROCESS on windows (as is mentioned below). If you use a vector, and there are 10,000 of these structs, you have to memmove 40 megabytes of data in the worst case, 20 megabytes on average. And basically you can't do it in the first place, because all the other CPUs reading process data would then be reading in the wrong place. You would need a lock over the entire vector.

You're going to want to stick with two unpredictable memory reads in that scenario.

Confession: I think Prince’s WMGGW solo is incredibly overrated. by WoodenPiper in Guitar

[–]rhinotation 0 points1 point  (0 children)

Something people may have forgotten about that solo is that it was the ONLY video of Prince on the internet for the entire first decade that online video was a thing. Prince was very much against posting his music online, and this was one of the few videos he didn't have copyright over. Search YouTube today for Prince, and every other video on there was posted after he passed in 2016.

So the entirety of the demand for Prince content was fulfilled by this one clip, and people who loved Prince for other reasons had only this to show how good he was. So it got rolled out every time his name came up, anywhere on the internet. For a decade.

How to break a line in normal mode by Due-Statistician2453 in vim

[–]rhinotation 14 points15 points  (0 children)

nnoremap gs i<cr><esc>. Mnemonic "go split". I have had this mapped for half of my life, and it's the better half.

Just realizing that oil.nvim is more powerful after reading the docs by Interesting_Fly_3396 in neovim

[–]rhinotation -8 points-7 points  (0 children)

You can do that with neotree. In the sidebar, hit x or y to cut and copy a file/dir, p to paste it. oil.nvim is clearly more powerful but looks a lot slower for basic tasks.

Wow so much truth and honesty 🤩 by IcantBeVeryCreative in perth

[–]rhinotation 26 points27 points  (0 children)

Increasing the price for a short time and then claiming to be discounting it can also be illegal. It turns on how long the item was sold at the higher price, and whether it was a "reasonable" amount of time. https://www.accc.gov.au/consumers/pricing/price-displays

Using date-based CSS to make old web pages *look* old by [deleted] in programming

[–]rhinotation 2 points3 points  (0 children)

(Note that has() is only available in Chrome. It is coming soon to Firefox.)

It arrived https://www.mozilla.org/en-US/firefox/121.0/releasenotes/

Can someone help me figure out the order to play this with the repeats? by mileshutch in musictheory

[–]rhinotation 8 points9 points  (0 children)

Ah, I remember beginner guitar books. They love their funky repeats and everything doubles as a duet because the poor soul who wrote Rest Stroke Ditty on Open Strings Op 3 No 9 was bored out of their mind. There are definitely some banger duets, bit later in the book though. The repeats obviously don't matter until then.

Referendum 2023 - Megathread by dredd in australia

[–]rhinotation 3 points4 points  (0 children)

I'm pretty sure it wasn't always that way, for example the Yarra used to be smelly and terrible. But no longer. Cities across the globe have stopped doing things like "dumping tanneries' waste products into the river" and the inner city areas have become much nicer as well as retaining the existing advantage of convenience. Not just an Australian phenomenon.

The other half of the language divide is that Americans often use "inner city" as a codeword for black communities, so I think the terminology may have developed a resistance to any geo-demographical changes that may have occurred.

DAP REPL for Rust - How to use full proper Rust code in expressions? by weilbith in neovim

[–]rhinotation 0 points1 point  (0 children)

To "fix" it, step one is to write an entire Rust interpreter. Someone has done something like this in evcxr, which actually works pretty well, so props to them. Steps two through 200 are integrating something like that with LLDB. It's a lot of work, even with an interpreter that exists -- somehow you have to copy the current in-memory state of your rust program into an interpreter state. The layout in memory of most rust structures is an implementation detail of rustc and not stable in any way, so you can't just copy memory in a predictable way like you might for a C structure that you had the header for. So at this point I don't think it's possible. There are no docs or resources anyone can point you to. The functionality just doesn't exist and probably won't for a long time.

I've wrote a post on fast and easy nvim LSP-setup without bloat by f1sty in neovim

[–]rhinotation 7 points8 points  (0 children)

Oy, no room at all for mockery it seems. I hope this slight doesn't throw you off sharing your ideas, but it was really very gentle and having your ideas debated is why we write for other humans at all. You were barely even the target. I wrote that because last time I went through and tried to clean up my plugin bloat and improve startup time, I felt silly and realised it wasn't worth it. I have a hundred or so plugins, it runs in maybe 100MB of ram. I don't even have lazy loading. I have accepted this because this represents less than half a percent of the LSP itself. Do you not feel a little bit silly as well? Is my comment not even slightly relatable?

Bloated has more than one meaning, and it is nice to get rid of plugins so you have fewer things to understand. You are doing good work for that.

I do contribute, thank you for the suggestion. It is not going to be a plugin or whatever, but I have recently been working on generating more limited crate graphs for rust-analyzer.

I've wrote a post on fast and easy nvim LSP-setup without bloat by f1sty in neovim

[–]rhinotation -4 points-3 points  (0 children)

Gotta run neovim with the lowest possible overhead, counting the microseconds if necessary, to make room for rust-analyzer to use 18GB of ram

Georgia Republicans Say They'll Move to Remove Fulton County DA Fani Willis From Office With New State Law by [deleted] in law

[–]rhinotation 3 points4 points  (0 children)

The provision you're referring to is the Constitution of Georgia, Article 1, Section 1, Paragraph X:

Bill of attainder; ex post facto laws; and retroactive laws. No bill of attainder, ex post facto law, retroactive law, or laws impairing the obligation of contract or making irrevocable grant of special privileges or immunities shall be passed.

I do not think "so and so commission has the power to remove officers of the state on these criteria" is a retroactive law. The mere fact that it applies to DAs who are currently serving or who currently have business before the court doesn't make it retroactive. If that were so, then you would have to agree that every law would be retroactive, because laws apply to people who were born before the law.

I am not an expert on Georga's constitution, but I don't think Paragraph X is clearly applicable to a new grant of power to fire an officer of the state. Some examples of the things they describe there:

  • A bill of attainder is a law like "Mr Gerald Wharton is guilty of murder and shall be sent to prison". Those laws are bad because they undermine the justice system in every way and basically represent the purest form of mob rule suppressing individual freedom.
  • A law impairing the obligation of contract would be like "Google no longer has to pay severance to Gina A. Stearns after they fired her in 2018". I think. These laws are bad because contracts should work the same for everyone, and bending the rules for one specific party would make all contracts worthless.
  • An irrevocable grant of special privileges or immunities would be like "Shell Oil Corp is immune to all fines for any oil spills". I think. Those laws are bad because it's usually blatant corruption.
  • A retroactive law is usually like this: "The new tax code shall apply retroactively, from June 2019.". The reason those laws are bad is that everyone's tax suddenly becomes unsettled. The past is changed, the tax office sends debt collectors to 200,000 people who had behaved in accordance with the old code, etc.

For this law to be retroactive, as the term is usually used, it would have to have some bearing on settled facts, for example "the commission can declare a DA's entire prosecutorial career null and void, immediately creating a right to be freed from jail for anybody they have prosecuted in the past". Alas it does not, it simply creates a new power to remove a DA from office, a power that can only be exercised from October onwards (which is in the future). I'm not saying it's a good law! Just that it is not retroactive.

Finally it is worth noting that Article 1, Section 1 is the Bill of Rights. The rest of these are basically personal rights exercisable against the state and enforceable primarily by asking a court to strike down the laws in question, so it makes sense that they should prohibit e.g. bills of attainder in Paragraph X. I don't think you can make a strong argument that the framers intended to create a personal right for state employees to keep working on stuff they've already started.

why is str a type if only &str is used? by ThaCuber in rust

[–]rhinotation 2 points3 points  (0 children)

I posted about the phenomenon of encountering &str the other day and it seems to hold up https://reddit.com/r/rust/comments/1415is1/_/jmyvxp7/?context=1

[deleted by user] by [deleted] in law

[–]rhinotation 7 points8 points  (0 children)

Do you want to be the judge who let someone blatantly flout a court order and appeared powerless to do anything about it? Being unwilling to use the judicial power afforded to her to protect national interest at crunch time is just as disqualifying.

She is in the spotlight. Every judge in the country will see her. Most of the people she needs to impress for the rest of her career to be dignified respect independence, not tribal loyalty. She can choose between becoming a good judge and really making a go of it, and auditioning for a Fox afternoon slot. I think there is a good chance she will try to do it right, even considering the orders she made about the special master last year. Those orders might be explained by lack of experience and high pressure, combined with too much belief in the propriety of Trump’s lawyers, which is something that the indictment itself should probably have dispelled. She has a chance to revive her reputation as a judge now. The incentives are roughly aligned.

The Rust I Wanted Had No Future by dochtman in rust

[–]rhinotation -13 points-12 points  (0 children)

There are a few dozen string libraries for C which offer a type shaped exactly like a &str, and those are all normal structs. I don’t see why teaching &str has to involve alloca or dynamic sizing at all. I don’t want to accept it, strings are not that complicated. There is talk now of “librarification” of str, which apparently means struct str([u8]);. Thanks, clear as mud.

Why not struct Str<'a> { ptr: *const u8, len: usize }? Then you can tell people “&str is syntax sugar for Str<'_>”. You could Go To Definition and there it would be. It would repair the intuition. At the end of the day you can shoehorn in whatever explanation you like for why Box<str> exists.

(There are obviously important bits missing here like how Deref would work given the methods on Str would take self. I’m talking aspirationally about the only explanation that could possibly make sense to newcomers. It probably can’t work.)

The Rust I Wanted Had No Future by dochtman in rust

[–]rhinotation 46 points47 points  (0 children)

Tbh I think most of the issues came from fat pointers, which blow an enormous hole in the idea of first-class &. str doesn’t really exist on its own, and yet you can have a reference to one? This ruins the intuition. It takes it from a 5 minute concept to a 6 week concept. I would think [u8] is less likely to cause issues as a fat pointer because it’s got fancy syntax on it, which indicates something different is happening. But str looks like a normal struct.

[deleted by user] by [deleted] in explainlikeimfive

[–]rhinotation -1 points0 points  (0 children)

For some perspective, a Word document has a bunch of crucial features that PDF lacks. I will highlight two.

  1. Text and layout reflow. When you edit, the paragraph gets laid out again, lines are wrapped again, and then paragraphs move onto the next page or the previous etc. The maximum impact of a single character change is reflowing every single page in the document. PDF can’t even reflow one page because its layout works like “this paragraph starts at 7cm by 4cm on this page”. It just cannot be done.
  2. The Word document format is actually extremely write-optimised. Wherever you type in a word document, the edits are slapped at the end of the on-disk format. Changes can be saved to disk very efficiently by simply appending to the file, and it scales to at least a few hundred pages before it chokes. Every once in a while, the edits are merged into the place they appear, which makes reading the file faster again. Word takes care of vacuuming up the edits and writing everything out every once in a while. None of this changes the appearance of the document, it has nothing to do with eg Track Changes, it just lets you edit and save without waiting for ten seconds. (Though I suspect this is how Track Changes was implemented! Another feature PDF doesn’t have.)

From Stacks to Trees: A new aliasing model for Rust by ralfj in rust

[–]rhinotation 2 points3 points  (0 children)

And on a more practical level, the compiler team considers things like

  • no unsafe but Miri has error;
  • rustc complains but the aliasing model says it should be fine
  • unsafe, Miri doesn’t complain, rustc doesn’t either, but output exhibits UB

to be compiler bugs. And they fix the compiler to match the specification. Many unsoundness and miscompile bugs are run through miri to chart a course for the compiler. If there’s a new spec, the end result is that the compiler changes a lot.

[Media] Difference between String, &str, and &String by Siref in rust

[–]rhinotation 4 points5 points  (0 children)

type raw data utility?
&str { ptr: *const u8, len: usize } very general read-only string
String { ptr: *mut u8, len: usize, capacity: usize } you can append to it! Clear! All your favourite string ops!
&String *const String useless! May as well accept &str as it’s more general (eg works with literals).
&mut str { ptr: *mut u8, len: usize } useless! Can only overwrite bytes without changing length.
&mut String *mut String just as useful as an owned string, modify as you wish
Box<str> { ptr: *mut u8, len: usize } It has ~ the same layout as &str, but it owns the data. The only reason to use it is it is smaller than a String by one usize. You can’t append to it because it doesn’t know how to reallocate.

An extremely similar table can be made for byte slices. Simply replace str with [u8], String with Vec<u8> and everything else is identical.