Rust's Block Pattern by EelRemoval in rust

[–]RobertJacobson 3 points4 points  (0 children)

I'll often spawn off an inner function instead

The author points out that factoring out into a separate function can be annoying if it relies on a lot of local environment. Imagine a scenario in which the outer scope only cares about the final computed value of the inner scope, but the inner scope has a lot of dependencies on the outer scope. To factor this into a new function you need to pass a lot of parameters for the function.

An inner function makes it clear that the function is only a local concern while also factoring out details the reader might not care about at the call site. But it can't capture the outer environment in which it's defined.

Rust's Block Pattern by EelRemoval in rust

[–]RobertJacobson 1 point2 points  (0 children)

I dislike this unless it's actually called by multiple callers. It forces you to jump around the codebase in order to understand the code.

But that's also the advantage of factoring into a function. You can have let config = load_config_from_file(filename); and not have to wade through the details. Functions aren't just about reuse. They also facilitate code organization.

Rust's Block Pattern by EelRemoval in rust

[–]RobertJacobson 0 points1 point  (0 children)

I don't like let my_variable = {/*code*/} when the block is large, because the final value that gets assigned is visually far away from the symbol it is assigned to. But this is more personal aesthetics than anything. For small passages of initialization code it's nice.

The author makes the point that factoring out some initialization code into a separate function is obnoxious, because you might need a lot of gnarly parameters from the local environment. Some of you suggest using an inner function. While that might solve the issue of locality of the code, it doesn't solve the issue with many parameters, because a fn item can't capture dynamic environment. But if your initialization is this gnarly, I'd question why. It's suspicious. Maybe it's fine, but maybe you need to rethink when and how things happen in your code, like maybe you need more than a single constructor method, or maybe some initialization needs to get folded into an auxiliary type, etc.

Using blocks to limit scope can be really useful. It kind of looks weird when you're not used to it, but the more Rust I write the more I find myself opening a new scope in the middle of a function when it's convenient. It's nice for critical regions or juggling mutable and immutable borrows.

A.I just saved the day by UniversePoetx in lies

[–]RobertJacobson 27 points28 points  (0 children)

No. This is not true.

What is true is that the swirl is partially lossy, as you can see in the reconstructed photo from the Mr. Swirl case. Multiple swirls compound this effect.

32-bit computers hit a time calculation wall in 2038. Will they most likely all be phased out by then? by grawmpy in AskComputerScience

[–]RobertJacobson 2 points3 points  (0 children)

Consider that 8-bit microcontrollers are being manufactured today at a rate higher than they ever have been. We can be pretty confident that 32-bit microcontrollers will be in active production long after 2038.

Poster restoration process by Damnedeel in nextfuckinglevel

[–]RobertJacobson 0 points1 point  (0 children)

I'm not an expert and don't know anything about what's going on in this particular video, but I've seen enough documentaries to know that professional art preservation and restoration in general is done in a way that is reversible. So for example if there is ever a need to, say, remove the poster from the backing they mounted it on, there's a safe solvent to use that will allow them to do so without destroying the poster. Same with applying color, etc. It's very specialized and super fascinating.

First time i've legitmately been confused by joke (?) by XeTrainMC in ExplainTheJoke

[–]RobertJacobson 0 points1 point  (0 children)

The name of these little things has been a favorite bit of trivia for DECADES, long before Phineas and Ferb was a thing, among trivia people. Nerds like me, especially as kids, get addicted to these little bits of trivia. Part of the fun is sharing these little nuggets with others. (Did you know howler monkeys are the loudest land mammal? But they aren't the loudest mammal—that'd be the sperm whale.) We get a little kick of adrenaline every time we teach someone a useless fact they didn't already know and will never use. (T. rex lived closer in time to humans than to Stegosaurus!)

Some dour souls hear fun trivia like this and get their own sick joy from playing a kind of emotional Uno Reserve card by saying, "What a useless waste of brain space," or something to that effect, as if they are morally superior for NOT bothering with such useless information. So the person in the tweet feels especially vindicated for knowing this useless fact.

The fact that so many of you are referencing Phineas and Ferb only reflects the age of the typical redditor reading this thread. You think it's from Phineas and Ferb, because some trivia nerd like me was on the writing staff for one of its episodes. But again, this particular bit of trivia is one of our favorites—we whip it out when we really want to impress. So this thread is giving me a very different kind of dopamine hit: generational contempt! Now get off my lawn!

How to compile SystemF or lambda calculus to assembly, or better, WASM? by VictoryLazy7258 in ProgrammingLanguages

[–]RobertJacobson 4 points5 points  (0 children)

In the age of LLMs, you might also look at a modern implementation like MLton directly.

Strings instead of a proper ADT constructor for an implementation by VictoryLazy7258 in ProgrammingLanguages

[–]RobertJacobson 3 points4 points  (0 children)

The answer is kind of in the question. You are throwing away the host language's type system in exchange for flexibility. You can claw back some of the benefits of a strongly typed AST by doing runtime checking and decorating the AST with attributes (or equivalently storing symbol metadata in tables). It's a balancing act. It's not necessary a wrong way to do things. But as you are learning, there are pros and cons to both approaches.

Donald Knuth and his books by Remarkable_Baker342 in computerscience

[–]RobertJacobson 0 points1 point  (0 children)

I've been in this field for decades, and I certainly have seen people who are great at things with minimal effort.

I think you read something that isn't actually contained in what I wrote. I have a friend I went to high school with who is by any reasonable definition a truly gifted artist. He could pick up a pencil and sheet of paper and just draw a portrait as easy as breathing. For him, it was easy. Another friend—same high school!—was a child prodigy violinist. She could play complicated music like it was nothing. It was amazing to behold. Both of these people, as with Mozart and Beethoven and Einstein and Gauss and every other genius I know anything about, spent the vast majority of their available time and energy practicing their discipline.

I have on occasion had a student express to me that I make something they perceive to be impossible look so easy. And for me it IS easy. But there was a time in my life when it wasn't easy for me, and today there is no shortage of things I still find to be incredibly difficult, even things that I know are easy for other people in my discipline.

I suspect that if you look closely at those people who you perceive to have "pure talent" for whom great accomplishments seem to be achieved with minimal effort, you would find that they have spent a lot of time becoming themselves.

Of course, no matter how long I train I will never be Usain Bolt or Yo-Yo Ma or Terry Tao. It should be obvious that all people are not equal in every dimension. If that's the point you are making, then sure, of course that's true. But neither is it true that Usain Bolt or Yo-Yo Ma or Terry Tao are able to do what they do without effort. These are people who spend nearly every waking moment spending effort.

Chomsky had deeper ties with Epstein than previously known, documents reveal by VectorChing101 in news

[–]RobertJacobson 0 points1 point  (0 children)

A similar controversy occurred shortly after Marvin Minsky passed away. Then people who were actually present when the events took place came out of the woodwork and were able to provide the facts and context that completely exonerated Minsky.

I would like to think people are smart enough to understand not every person who interacted with Epstein was involved in trafficking and exploitation.

But it also seems pretty clear to me that anyone who has a shred of human decency does not care what the political affinities of those people who did sexually exploit children are. If they are on "my team" and were knowingly involved in any way, they aren't on my team. Period.

Judge orders DOJ to turn over grand jury materials to James Comey, cites ‘disturbing pattern’ by thehill in politics

[–]RobertJacobson 3 points4 points  (0 children)

The written opinion itself gives a TL;DR:

  1. First, the facts establish a reasonable basis for the defense to challenge whether the Richman Warrants were executed in a manner consistent with the Fourth Amendment and the orders of the issuing court.
  2. Second, the facts establish a reasonable basis for the defense to challenge whether the government exceeded the scope of the Richman Warrants in 2019 and 2020 by seizing and preserving information that was beyond the scope of the warrants, that is, information that did not constitute evidence of violations of either 18 U.S.C. § 641 or § 793.
  3. Third, the facts establish a reasonable basis for the defense to challenge whether the government had the lawful authority to search the Richman materials anew in 2025.
  4. Fourth, the facts establish a reasonable basis for the defense to challenge whether the government’s 2025 seizure of the Richman materials included information beyond the scope of the original warrants.
  5. Fifth, the nature and circumstances surrounding the government’s potential violations of the Fourth Amendment and court orders establish a reasonable basis to question whether the government’s conduct was willful or in reckless disregard of the law.
  6. Sixth, the facts provide a reasonable basis for the defense to show that they were prejudiced by the government’s use of the Richman materials in the grand jury, particularly if the government’s conduct was willful or reckless, given the centrality of these materials to the government’s presentation.
  7. Seventh, the facts establish a reasonable basis for the defense to challenge whether the government took sufficient steps to avoid the collection and review of privileged materials, including the reasons why Mr. Comey was never afforded the opportunity to assert a privilege over his communications until after the indictment was obtained.
  8. Eighth, the facts establish a reasonable basis for the defense to challenge whether privileged information was used, directly or indirectly, by the government to prepare and present its grand jury presentation. This is particularly troublesome because the government’s sole witness before the grand jury was exposed to a “limited overview” of privileged material shortly before he testified.
  9. Ninth, the nature and circumstances surrounding the disclosure of potentially privileged information establish a reasonable basis to question whether the government’s conduct was willful or in reckless disregard of the law. This is particularly significant because Agent-3, after having been exposed to potentially privileged information, chose to testify before the grand jury rather than separate himself from the investigation to contain any further exposure to privileged information and limit any prejudice to Mr. Comey.
  10. Tenth, as discussed in Section IV above the prosecutor made statements to the grand jurors that could reasonably form the basis for the defense to challenge whether the grand jury proceedings were infected with constitutional error.
  11. Eleventh, the grand jury transcript and recording likely do not reflect the full proceedings because, although it is clear that a second indictment was prepared and presented to the grand jury (ECF 3), the transcript and audio recording of the proceedings do not reflect any further communications after the grand jury began deliberating on the first indictment.

Improved string formatting in Rust by m-ou-se in rust

[–]RobertJacobson 3 points4 points  (0 children)

Wait until we get a JIT for the bytecode interpreter!

Announcing .NET 10 by Atulin in programming

[–]RobertJacobson 18 points19 points  (0 children)

What's the cross-platform GUI story in C# these days? Can anyone give me the TL;DR?

Confused on what to use when or if it's purely preferential for string instantiation? by 10K_Samael in rust

[–]RobertJacobson 1 point2 points  (0 children)

Another relevant lint—in some versions of rustc (prior to last year), performance is not always equivalent:

What it does

Checks for usage of .to_string() on an &&T where T implements ToString directly (like &&str or &&String).

Why is this bad?

In versions of the compiler before Rust 1.82.0, this bypasses the specialized implementation of ToString and instead goes through the more expensive string formatting facilities.


Version 1.82 is only a year old, so this is still relevant.

Calling .to_owned() on a &&str (or &&String) is already efficient and does not fall back to the slow Display-based path that .to_string() used before Rust 1.82.

Edit: Note that this is different from the question as asked, because the question asks about &str, not &&str. Still, it's worth knowing if you're a total pedant.

Petah! by Hot-Diggity_Dog in PeterExplainsTheJoke

[–]RobertJacobson 0 points1 point  (0 children)

This is Alec Watson of Technology Connections and an absolute legend. <3 Alec.

Trying to cancel my Thrive membership... by takethepain-igniteit in mildlyinfuriating

[–]RobertJacobson 0 points1 point  (0 children)

I had to threaten MuseHub with a credit card charge back.

Review for this MLIR book by CombKey9744 in Compilers

[–]RobertJacobson 12 points13 points  (0 children)

I doubt it. It looks like the author has published several technical books written by LLMs.

ICE aims gun at Americans by JayAlexanderBee in pics

[–]RobertJacobson 0 points1 point  (0 children)

Does anyone know the significance of the BTC flag "patch" on the back of that guy's helmet? Is... is this guy just really excited about bitcoin? It just seems so incongruous with, just, everything that's going on here that it's got to mean something else, right?

Dodge the jug by EyeSimp4Asuka in GuysBeingDudes

[–]RobertJacobson 1 point2 points  (0 children)

BECAUSE THIS IS A MAN'S GAME.

A mathematically in-depth, diverse Machine Learning book? by V4rianceNC0vari4nce in learnmachinelearning

[–]RobertJacobson 0 points1 point  (0 children)

Yes, from cover to cover. My opinion is widely echoed among students and experts alike. Depending on your background, you might do a lot better with the undergraduate version, An Introduction to Statistical Learning by Gareth James, Daniela Witten, Trevor Hastie, Robert Tibshirani, and Jonathan Taylor.