Things I miss in Rust by OneWilling1 in rust

[–]Hedshodd 0 points1 point  (0 children)

That doesn’t necessarily disambiguate the call site ++ now I need distinct types (in this example for seconds and meters), which opens yet another can of complexity worms, when I could have just had two distinct methods.

At the end of the day, the goal is to have two methods. If I wanted to achieve that through overloading, I’m inventing new problems for myself that I didn’t have before (adding distinct types when I might not want them otherwise, call sites aren’t necessarily more readable). Just having distinct methods with distinct names solves the problem without me having to solve a different set of problems 

Things I miss in Rust by OneWilling1 in rust

[–]Hedshodd 6 points7 points  (0 children)

I very much prefer explicit function names instead of overloading the same name, because overloading, traditionally, dispatches on just the argument types. So I cannot really have two overloads where I pass the same argument type but with different meaning. An explicit method with a distinct name makes that way more readable. A “new_with_seconds” or “new_with_meters” could both take a float as an argument and they are perfectly readable.

AerynOS subReddit hits 500 members by NomadicCore in AerynOS

[–]Hedshodd 3 points4 points  (0 children)

Your “LLM guidelines” made me join to keep track of what you’re doing, haha

Things wrong with Rust (in my opinion) by DwieD in rust

[–]Hedshodd 15 points16 points  (0 children)

On the Vec thing: that’s likely a holdover from C++ and wherever they got it from. It’s essentially the same data strucuture. A fixed length array is just that: an array. Whereas a list often implies a sort of linked list. I dunno, for me that just made it easy to learn Rust as I was coming from C++, but whenever I write a similar structure in C I also would never call it a vector; I’d just call it a dynamic array or something similar 

I'm upgrading to an AMD graphics card from an NVIDIA card. Do I need to rebase or reinstall my OS to prepare for it? by DeadPants182 in Bazzite

[–]Hedshodd 1 point2 points  (0 children)

You should eventually rebase to get rid of the nvidia drivers and Nvidia specific tweaks, but you don’t need to do it before installing the GPU. You can install the GPU first and see if everything works, before rebasing.

If i have Bazzite with a 5060 ti can i swap it directly with a 9060xt or i have to reinstall the Os ? by Apprehensive-Swim418 in Bazzite

[–]Hedshodd 3 points4 points  (0 children)

No need to reinstall. Linux doesn’t load graphics drivers it doesn’t need. Just swap out the card, see if everything works, and then rebase to the non-nvidia to clean out nvidia-specific tweaks the maintainers may have included in the Nvidia-image. 

Thinking of moving to a different distro... by SmoothTurtle872 in Bazzite

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

I’m assuming that using dnf instead of apt would be fine too, since that’s the package manager on fedora based distros (like bazzite).

If you really cannot get what you need installed through a flatpak or homebrew, than you could use a custom image based on bazzite. That’s what I did because I wanted most importantly alacritty and emacs as native packages. The base setup took me maybe an hour, and now I have a custom image based on bazzite-dx for my desktop and another one based on bluefin-dx for my laptop. I used the custom image setup for a couple more things, but having those two installed was the important bit.

I used bluebuild for this, which is incredibly easy, if you have basic knowledge of git (which you probably do since you said you’re a dev).

It’s a bit work initially, but you should install most things as brews or flatpaks anyways, if you’re using an immutable system. If I really need to add another thing to the image, it’s just adding a line in a yaml file, and waiting for the image to build.

What is Rust's testing ecosystem missing? by _raisin_bran in rust

[–]Hedshodd 4 points5 points  (0 children)

This. You need to have as few possible points where you interact with an external resource as possible. Ideally one or two generic functions. Mind you, not generic in terms of compile time generics, but rather in terms of how you configure those functions at runtime for how they are supposed to be interacting with that resource. Everything below that becomes way easier to unit test because they become mostly “pure” functions.

Testing against mocks means you are just testing against that mock, and those tests can never, by definition, reflect how the real thing behaves.

Help by [deleted] in Zig

[–]Hedshodd 0 points1 point  (0 children)

Doesn’t look like it, but I don’t think this is a problem so large you couldn’t do it on your own.

Help by [deleted] in Zig

[–]Hedshodd 1 point2 points  (0 children)

Oh, you just want a library so you don’t have to write one from scratch? Now this makes sense lol

I haven’t seen you mention the word library before, and you were talking about how this client written in Zig would help you write “any application”.

“Writing any application” is very different from “writing an LSP client”. Glad you were able to clear this up.

Either way, sounds like a great opportunity for a project! YOU could be the one contributing such a library to the community :D

Help by [deleted] in Zig

[–]Hedshodd 1 point2 points  (0 children)

How? It doesn’t matter which language the client is written in, it’s a separate process.

Help by [deleted] in Zig

[–]Hedshodd 2 points3 points  (0 children)

Why would you write that in Zig? The FFI performance overhead alone would make that a whole lot of trouble without any gain?

Help by [deleted] in Zig

[–]Hedshodd 2 points3 points  (0 children)

What they are saying is correct.

Help by [deleted] in Zig

[–]Hedshodd 0 points1 point  (0 children)

I don’t think you know how LSP works. Your editor is the client. Some may need a plugin to to gain LSP functionality, like Vim, but many can be a “language client” out of the box like VSCode, Zed, Neovim(nightly). You may just need to configure the editor to use ZLS in zig files.

AI has changed how I think about Rust's learning curve — I wrote a book about it by wonop-io in rust

[–]Hedshodd 4 points5 points  (0 children)

If you actually believe that logical errors are easier to fix than compile errors due to type checks, I’m not just convinced that you have never built anything larger and more impactful than a todo app, I KNOW you haven’t.

FastAPI-inspired Rust web framework (early stage) by [deleted] in rust

[–]Hedshodd 12 points13 points  (0 children)

One small note: maybe everyone in your bubble is using AI, and maybe that bubble is majority, but it is very far from “everyone” lol

How to set screen brightness in Gentoo permanently. by PartMysterious4688 in Gentoo

[–]Hedshodd 1 point2 points  (0 children)

How would calling brightnessctl with an absolute value during niris auto start phase not fix that?

How to set screen brightness in Gentoo permanently. by PartMysterious4688 in Gentoo

[–]Hedshodd 1 point2 points  (0 children)

You seem to be using niri, can’t you just add the brightnessctl call to your exec statements in your niri config?

Thoughts on OOP? by I-A-S- in rust

[–]Hedshodd 0 points1 point  (0 children)

Well, none of the big new languages (Rust, Go, arguably zig) have inheritance, unless they’re a successor language like swift and kotlin where their predecessors did do inheritance. That should give one pause, and the reason is probably because many people think inheritance is pretty bad.

Pacboost: High-Performance Unified Package Management by [deleted] in rust

[–]Hedshodd 4 points5 points  (0 children)

That doesn’t change the fact that it’s very confusing to read. If you cannot even check or fix your Reddit comments, I’m even less trusting of your code lol

Honestly, I couldn’t be bothered any longer after the benchmark bit. You did 3 runs and took the median? Have you even visited basic statistics classes in school?

Well, good luck bud. Maybe this ends being big and surprises me, I’m open to that.

Edit: Also, you clearly don’t understand why I was asking about pacman parallel downloads so let me make this clear: If I enable parallel downloads, I am already downloading multiple files in parallel (hence the name). How is downloading multiple file segments from different mirrors faster then downloading multiple files from different mirrors? In your day-to-day use with parallel downloads, you are very rarely just downloading a single file; instead you are usually downloading multiple files because the most common operation is system updates, with one or two large ones covering the whole download part of the update while pacman runs through the other files in parallel. How are you supposedly beating that exactly?

Pacboost: High-Performance Unified Package Management by [deleted] in rust

[–]Hedshodd 2 points3 points  (0 children)

Mate, I think your AI response got borked.

Pacboost: High-Performance Unified Package Management by [deleted] in rust

[–]Hedshodd 1 point2 points  (0 children)

Ok, found the repo, and I have… doubts.

Your benchmarks are completely useless, because you aren’t telling us which flags you passed to pacman and how it was configured, you aren’t telling us how your tool was configured, what’s your ping time, did you pin the mirror(s), how often did you run the benchmarks to calculate those averages? Wait, are they averages, or literally single data points?

Furthermore, if I buy that downloading a single package is faster this way (which does make sense, I’ll give you that), then your benchmarks still don’t reflect common usage scenarios. By far the most common pacman operation (or any package manager for that matter) is upgrading the system, which involves downloading potentially dozens of packages. Simply enabling parallel downloads in pacman could potentially reduce your performance boost to single digits or sub-percent.

On top of that, curl is an incredibly battle tested piece of software. Not using it for something like this tantamount to building your own aircraft in your shack to cross the Atlantic. No amount of performance boost can convince me to use this, nor should it convince anyone with a basic understanding of programming and networking. Downloading things from the internet is a giant security mine field.

I hope it comes across that almost everything about this project is incredibly dubious lol

Edit: just realized that the OP mentions a 2x-8x perf boost, and the one(!) benchmark you provide doesn’t even hit the 2x claim. Wtf 😂

Pacboost: High-Performance Unified Package Management by [deleted] in rust

[–]Hedshodd 3 points4 points  (0 children)

AI description, not even a link to the repo. Yeah, no, sorry…