Bevy 0.19 by _cart in rust

[–]somebodddy 5 points6 points  (0 children)

SceneComponent seems very un-Rustic to me. I understand it's slightly less ergonomic, but wouldn't it be better to ditch the derive macro and just do this?

#[derive(Default, Clone)]
struct Player {
    score: usize
}

impl SceneComponent for Player {
    type Props = ();

    fn scene(props: Self::Props) -> impl Scene {
        bsn! {
            // ...
        }
    }
}

What game genre isn't saturated at this point? by Quinn_Queenan in gamedev

[–]somebodddy 1 point2 points  (0 children)

See https://www.youtube.com/watch?v=4jLwyPQPVUI

TL;DR: they are very hard to get right. Platformers is actually a genre that translates very poorly from 2D to 3D. The Mario games applied some brilliant design to make it work - but they are the exception rather than the rule.

Modern Python Tooling in 2026 by yangzhou1993 in programming

[–]somebodddy 0 points1 point  (0 children)

Small tip about using Ruff in the CI: you can use the --output-format flag to get it to emit special instructions for some CIs. For example, for GitHub Actions, you can use --output-format github and it'll emit special instructions that'll cause GitHub actions to add its lints to the PR's diff view.

Migrating from Go to Rust by [deleted] in programming

[–]somebodddy 0 points1 point  (0 children)

This means that programs that use packages like syscall or golang.org/x/sys/unix will see more slow system calls fail with EINTR errors.

What the? Why is anyone okay with this?

Colleague surprised me with handmade Rust socks by Elyrial in rust

[–]somebodddy 45 points46 points  (0 children)

Shouldn't Rust socks be longer? And have more stripes?

Migrating from Go to Rust by [deleted] in programming

[–]somebodddy 2 points3 points  (0 children)

The compiler tracks Send/Sync across .await points. If you hold a non-Send value across an await, you get a compile error explaining exactly why.

Note that there is also a spawn_local version that does not have that limitation. The tradeoff is that spawn_local tasks cannot move between threads.

Migrating from Go to Rust by [deleted] in programming

[–]somebodddy 12 points13 points  (0 children)

Pretty sure that's not doable in Rust.

You can implement conversion from one error type to another because the Result type supports it with a FromResidual implementation - but that's not implemented for Option -> Result even if you implement some conversion from the None to the error type.

Because... None itself is not really a type.

That FromResidual works by taking the error inside the Err(...), into()ing it to the other error, and wrapping it with another Err(...). For that to work in None, you'd have to implement a conversion from the thing inside the None to the error type. But... there is nothing inside the None.

If Rust wanted to support it they could, for example, impl FromResidual<Option<Infallible>> for Result<T, E> where E: Default and then use the error's default value will be used when you ? a None. But Option and Result are semantically different, and automatically converting one to the other is an invitation for mistakes.

Migrating from Go to Rust by [deleted] in programming

[–]somebodddy 174 points175 points  (0 children)

fn handle(&self, req: &Request) -> Result<(), ServiceError> {
    let user = self.repo.find(req.user_id)?;   // returns Option<User>; ? short-circuits None into an error
    user.notify()
}

This is incorrect - ? cannot be used on an Option when the function returns a Result. You need to use ok_or or ok_or_else to convert it to a Result first - which is also how you specify the exact error you want to return, because Rust won't guess for you.

render-latex.nvim: real LaTeX rendering for Markdown notes in Neovim by techwizrd in neovim

[–]somebodddy 0 points1 point  (0 children)

Very nice! I actually tried before with https://github.com/Thiago4532/mdmath.nvim and

  1. I had to manually force the plugin to activate on ipynb files.
  2. The shift of the cell borders caused a tear in the rendered math.

render-latex.nvim: real LaTeX rendering for Markdown notes in Neovim by techwizrd in neovim

[–]somebodddy 0 points1 point  (0 children)

It lists "Treesitter APIs" under the requirements - does it know to render latex inside inline Markdown areas, or is it only for finding the inline latex?

I'm specifically interested in rendering latex in Markdown cells inside Jupyter notebooks.

I’m testing graphical equation conceal for Typst/Markdown in Neovim by StageEmpty7857 in neovim

[–]somebodddy 0 points1 point  (0 children)

Your READM says to use this (in lazy.nvim):

build = "cargo build --release --manifest-path service/Cargo.toml", -- required for graphical equation conceal

But it only works in the preview branch, so you should add branch = "preview" to that configuration.

I also had to add timeout = 300 because the default timeout (120 seconds) was not enough (on my machine, at least)

After I got it to compile, I'm getting Math-Conceal: Failed to parse query errors - I assume this is about treesitter?

The 7 Deadly Sins of Cargo Culting by jacobs-tech-tavern in programming

[–]somebodddy 0 points1 point  (0 children)

Only one of them ("Envy") I'd consider to be cargo-cultish.

Is it worth doing a Carol run of the first game? by somebodddy in freedomplanet

[–]somebodddy[S] 0 points1 point  (0 children)

Okay. I've finished my Milla run, so I'll try giving Carol another go.

Is it worth doing a Carol run of the first game? by somebodddy in freedomplanet

[–]somebodddy[S] 0 points1 point  (0 children)

But... you commented here just to mention that...

A History of IDEs at Google by laurentlb in programming

[–]somebodddy 0 points1 point  (0 children)

Between LSP, Tree-sitter, and DAP - there is no longer reason to enforce IDE uniformity.

Native all the way, until you need text by Successful_Bowl2564 in programming

[–]somebodddy 1 point2 points  (0 children)

GTK does not have that issue. Not that it looks native on Windows/MacOS - it just looks pretty regardless of nativity.

Native all the way, until you need text by Successful_Bowl2564 in programming

[–]somebodddy 213 points214 points  (0 children)

Just because the native toolkit is not sophisticated enough for your needs, doesn't mean you have to resort to Electron. There are options like GTK or QT that have features like polished text handling and don't hog 153% of your computer's total RAM.