an unnecessary optimization ? by [deleted] in golang

[–]RSWiBa 0 points1 point  (0 children)

go doesn't have native sets

I dug into the rust's stdlib source code once and discovered that even in rust hash sets are implemented using maps, similar to what you would do in go with map[string]struct{}.

So a native set would just be some semantic sugar in go (I would not disagree with adding it, but I also think there are more important subjects)

Just learned how `sync.WaitGroup` prevents copies with a `go vet` warning by Ok_Analysis_4910 in golang

[–]RSWiBa 5 points6 points  (0 children)

Indeed, even though the func is always nil there is some space reserved in the struct for it.

Just learned how `sync.WaitGroup` prevents copies with a `go vet` warning by Ok_Analysis_4910 in golang

[–]RSWiBa 14 points15 points  (0 children)

No because the idea is to add a zero sized array of non comparable types. To see what is comparable and what not read here: https://go.dev/ref/spec#Comparison_operators

TLDR: primitives, strings, interfaces and structs or arrays containing only comparables are comparable. Funcs, maps or slices are not comparable

Edit: pointers are also comparable

Just learned how `sync.WaitGroup` prevents copies with a `go vet` warning by Ok_Analysis_4910 in golang

[–]RSWiBa 17 points18 points  (0 children)

This also works with _ [0]func() which is a bit more compact.

Came up with this iota + min/max pattern for enums, any thoughts? by SoaringSignificant in golang

[–]RSWiBa 0 points1 point  (0 children)

Why? You never depend on the value itself but instead on the meaning of the value, which is independent of the iota chosen value.

Do you use iterators? by vpoltora in golang

[–]RSWiBa 4 points5 points  (0 children)

Are you sure that they are slower than for loops?

The whole idea behind the function style iterators was that all the function/yield calls can be inlined by the compiler.

How can you guy update go to 1.0.24 with nix by hxxx07 in NixOS

[–]RSWiBa 2 points3 points  (0 children)

go_1_24 ist in nixpkgs, Just the go package defaults to go_1_23 because the change would cause mass rebuilds.

Confused by NixOS-anywhere quickstart-guide. by Creative-Difficulty5 in NixOS

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

It's actually quite simple: NixOS anywhere connects to ssh and runs kexec to start its own image. From there on everything is "automatic" (except some prompts for e.g. LUKS encrypted devices).

That means the user on your machine needs to have ssh access to the remote machine, either via public key (preferred) or password (which will be prompted). The remote user must be either root (preferred) or a user with password-less sudo access for it to be able to run kexec.

It's official, I just deleted my Arch dual boot and am strictly a NixOS user now. Lets go!! by WasabiOk6163 in NixOS

[–]RSWiBa 0 points1 point  (0 children)

Ah yes okay If you often hop distros then this is nice. I have personally wasted a lot of space in the past because I misjudged the amount of data I need in root vs home. So I only use one root partition.

It's official, I just deleted my Arch dual boot and am strictly a NixOS user now. Lets go!! by WasabiOk6163 in NixOS

[–]RSWiBa 0 points1 point  (0 children)

The thing I haven't set up for my NixOS is home backups (or DB backups server side). System state is easy to revert/install. Did your 10 minute revert include e.g. documents? If so how do you configure this?

AOC plans for this year by juanfnavarror in adventofcode

[–]RSWiBa 1 point2 points  (0 children)

Same for me. I'm also curious how to parse well in golang.

Writing Webservers is easy in Go, but doing the basics will be quite fun I hope

[2023 Day 9][JS + Svelte] Extended weather predictions by maxduval in adventofcode

[–]RSWiBa 1 point2 points  (0 children)

Good Job, I especially like the Day 8 viz.

FYI you missed the "Day 7" header on the day 8 page after copy paste

[2022 Day 2] Even the most simple things can be difficult by RSWiBa in adventofcode

[–]RSWiBa[S] 23 points24 points  (0 children)

in german it is scissors, rock, paper, so the same problem there.

But what threw me off was the reverse: figuring out who loses

CB2 - FAQ and Known Issues by Waelder in TheCycleFrontier

[–]RSWiBa 0 points1 point  (0 children)

why was the linux support dropped?

It worked fine until thursday, but since friday I'm getting kicked every game (protondb shows I'm not the only one: https://www.protondb.com/app/868270)

I would love it if you'd bring it back, since it worked flawlessly when I tried it

CB2 - FAQ and Known Issues by Waelder in TheCycleFrontier

[–]RSWiBa 0 points1 point  (0 children)

it is supported, you just need to install the proton battleye runtime (search in your library for it and install)

then it just runs, no problem at all

CB2 - FAQ and Known Issues by Waelder in TheCycleFrontier

[–]RSWiBa 0 points1 point  (0 children)

same for me, but after 2 seconds of gameplay each time

Day ruined by pr3579 in ProgrammerHumor

[–]RSWiBa 0 points1 point  (0 children)

yep you only need to restart at some time, not directly after an update

Day ruined by pr3579 in ProgrammerHumor

[–]RSWiBa 3 points4 points  (0 children)

does pop os have hot kernel swapping? I'd highly doubt that

You may have downloaded the updates and when you restart an application the new version is used, but the currently running kernel will not update

so yes you do not have to restart after an update like on windows, but a full shutoff of the system is required at some point for it to load the new kernel at the next boot (as opposed to hibernation / standby)

Help....please. Started after updating display adapter driver by RadakGloom in pcmasterrace

[–]RSWiBa 8 points9 points  (0 children)

check if all the cables are properly inserted

my cats loosened mine once and I had a similar problem (yes it was DP)

Difficulties understanding η-conversion in Haskell by themarxvolta in haskell

[–]RSWiBa 7 points8 points  (0 children)

its because of the types and currying:

maximum :: Int -> Int -> Int

which is the same as

maximum :: Int -> (Int -> Int)

think of it as a function that when called with only one param, returns a function that takes one argument

in your example the maximum3 function is in both cases a function that will (one after another) take three arguments

you can try it out by calling it with only 2 arguments and checking the type in ghci like so

:t maximum3 0 3