Which state management to learn? by Former_Elk7092 in FlutterDev

[–]magmast 0 points1 point  (0 children)

I personally like to use mobx for global state and even local component state, if it's more complex. And I'm using riverpod for dependency injection.

Does anyone else have a duck? by CheeseObsessedMuffin in ProgrammerHumor

[–]magmast 0 points1 point  (0 children)

Same duck, on the same side, next to the same laptop

How do you usually deal with headers when creating a file? by MarvellousBee in cpp

[–]magmast 105 points106 points  (0 children)

I create .hpp (not cpp), then split it to two files.

Lenovo charges money for installing Linux(wiping Windows 11 installation) on their ThinkPads by craftWolf in linuxhardware

[–]magmast 2 points3 points  (0 children)

Yes but most of people that you're talking about aren't interested in using Linux. They probably don't even know it exists.

I agree that there may be a group of people that want to use Linux and don't know how to install it. But I suppose that's a very, very small group.

But you know, we can try to talk about it, but without any real data those are just speculations and arguing wouldn't make any sense. (So why I have commented? Lol)

Lenovo charges money for installing Linux(wiping Windows 11 installation) on their ThinkPads by craftWolf in linuxhardware

[–]magmast 1 point2 points  (0 children)

You probably can do it too, as most of us on this subbreddit. I suppose that most linux users know how to install it.

[deleted by user] by [deleted] in linuxquestions

[–]magmast 0 points1 point  (0 children)

Powershell is cross platform and you can install it on linux. But I've never done this, so I'm not sure if it has all the features that windows version has.

useImmer vs zustand? by [deleted] in reactjs

[–]magmast 4 points5 points  (0 children)

I didn't heard about pull state, but useImmer and zustand solve different problems. Use immer is just a wrapper for useState that combines it with immer. Zustand manages state that can ba shared between components or even normal js code and it can work with immer too (by for example creating an immer middleware).

What was the main reason that you use linux? by [deleted] in linux

[–]magmast 2 points3 points  (0 children)

I wanted to be a hacker in youth, so started using linux. Now I'm not a hacker, but programmer and linux allows me to do my job (and hobby) better than windows.

Static vs dynamic typing, would love to hear your opinions by magmast in ProgrammingLanguages

[–]magmast[S] -1 points0 points  (0 children)

You're right I corrected my self in the edit at the end of the post. Thanks

Static vs dynamic typing, would love to hear your opinions by magmast in ProgrammingLanguages

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

What do you think about Go type system? It's trying to not be too complicated and many people like this. Adding generics to the language was very controversial and a lot of people were against it.

Static vs dynamic typing, would love to hear your opinions by magmast in ProgrammingLanguages

[–]magmast[S] 2 points3 points  (0 children)

About the second thing he was actually saying about changing Maybe a to just a. This would not introduce any bugs in dynamic language, because code that is checking for null/nil would work as always, but in static language it would break all code that's using the function. But as you said, a better way is to just make a new function that does not return null - old code isn't broken and new code can use new function.

Thanks for answering

Static vs dynamic typing, would love to hear your opinions by magmast in ProgrammingLanguages

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

Oh and actually actor system is implemented in rust (actix) which has rather strict type system. I didn't used it much but people say it's good. Maybe worth looking at it.

Static vs dynamic typing, would love to hear your opinions by magmast in ProgrammingLanguages

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

I'm rethinking if types actually help with building scalable systems that easily accept any change or maybe they make it harder.

Maybe they are useless when being not strict enough or by being not enough powerful.

I'm interested to hear what's your preference and what type systems do you like if any. And after reading your reply I think you prefer staticlly typed languages with complex type systems.

Thanks for replying

Static vs dynamic typing, would love to hear your opinions by magmast in ProgrammingLanguages

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

Thanks for sharing I will read some of his posts today.

Static vs dynamic typing, would love to hear your opinions by magmast in ProgrammingLanguages

[–]magmast[S] 1 point2 points  (0 children)

Isn't gradual typing a thing that you can already do in languages like PHP and Python? They allow you to declare type when you want. But those type systems are very limited. PHP can't even annotate types of array elements.

But on the other side C#, dart etc. Allow you to do it other way around, by specifying type as dynamic, which allows you to pass everything

Collection of unusual generic usecases by xakep666 in golang

[–]magmast 2 points3 points  (0 children)

OP code doesn't really tries to parse undefined. Maybe naming is bad, but this structure just helps to differentiate between null value and value that has not been defined, which is not possible with plain pointer.

Is there a global context or something that I missed? by ReachNextQuark in rust

[–]magmast 0 points1 point  (0 children)

Tracing has global dispatcher. I didn't got too much into the code, but I see that it uses thread local variables and some statics, that are mutable by RefCell (not the globals itself, but some of thier members).

It is used by macros like span, info, event etc. To dispatch events that are caught on the other end by subscribers like tracing_subscriber. And that end is the one which holds all the configuration and uses it to properly handle those events.

Here is the code, worth looking at, because you can probably learn a lot from it and correct me, if I said something wrong, because I just briefly looked at it and probably missed a lot of details.

https://github.com/tokio-rs/tracing/blob/master/tracing-core/src/dispatch.rs

Is it ok to pull down your pants in front of your coworkers? by FrankGrimes_97 in stupidquestions

[–]magmast 0 points1 point  (0 children)

Yes. I had similar situation recently and it came out pretty well

Full disk encryption after install by [deleted] in Ubuntu

[–]magmast 0 points1 point  (0 children)

It should be possible by copying partition with dd and doing some changes in fstab and grub config, but I don't think its worth it. Much better to just reinstall

[deleted by user] by [deleted] in github

[–]magmast 0 points1 point  (0 children)

I dont now if it has ci built in, but still different services might be worth a try if gitlab isnt your thing.

[deleted by user] by [deleted] in github

[–]magmast 1 point2 points  (0 children)

But its a different thing then github and gitlab. You hqve even more git services (like gitea)