The problem might be the arc mutex. mpsc are already clone, send and sync. When you clone an arc mutex T, you are cloning the arc. But mpsc probably needs to be cloned itself to work properly.
- 2 Posts
- 717 Comments
The only thing I know about this pope is what I’ve gathered from Lemmy comments. According to those:
He’s homophobic and anti-trumpism in the aspect of immigrants.
I think that’s a pretty average catholic. Homophobia and helping the poor.
Neither progressive nor fascist.
If a crate only takes 35 lines to reproduce. Why is the author worried that it is unmaintained?
That crate is probably done, it does what it needs to do. And at 35 lines there’s not a lot of room for bugs.
Just use the crate instead of rewriting the same 35 lines for each project that needs them.
Or publish your own 35 line crate as an alternative. Then you can use your 35 lines instead of that guy’s 35 lines.
I don’t understand the LoC bit. First he says the project+dependencies is 3.6MLoC. then says that the Linux kernel is 27.8MLoC, then says his project is 7. 7 what? 7%? That’s not right. 7MLoC? I thought it was 3.6MLoC.
calcopiritus@lemmy.worldto Programming@programming.dev•CLion Is Now Free for Non-Commercial Use5·3 days agoIt may be true that there’s no better one. Which doesn’t mean that it’s good.
I have tried both clion and VSCode. I can’t think of many more IDEs other than Visual Studio (which I haven’t tried). I don’t think there’s many other options.
Clion is much faster than VSCode’s C/C++ extension. For example go to definition is instant while VSCode can take 10+ seconds each time, and it doesn’t cache results. However, that’s the only good thing I can say about Clion.
At work I use VSCode. Why? Because it works. CLion worked for like 6 months, and then it just refused to lead the cmake project, becoming absolutely useless.
calcopiritus@lemmy.worldto Programming@programming.dev•CLion Is Now Free for Non-Commercial Use34·4 days agoNot that it was much good to begin with, but enshittification is coming
calcopiritus@lemmy.worldto Lemmy.World Announcements@lemmy.world•Lemmy needs more donations42·4 days agoYes, .ml are tankies. They don’t have power outside their instance though. You are from lemmy.world. which means .ml mods can only ban you from participating in .ml communities (subreddits). Thy can also ban you so other users of .ml can’t see your content. But the rest of the instances will see it.
Blocking instances depends on what client you use. I use boost, and in boost you can block .ml communities from your feed. You can’t block content from .ml users though. I believe other clients allow you to block the users too.
calcopiritus@lemmy.worldto Lemmy.World Announcements@lemmy.world•Lemmy needs more donations12·4 days agoIf you want a wage. You want a job. You don’t give the product away for free.
If you give a product for free and the only revenue source being donations, you have to expect most people won’t donate, which means you’ll probably get a way-below-average wage.
It’s fine that they ask for donations. And it’s fine if people don’t pay them.
If their goal was to have an actual wage, they should ask for a subscription in order to stay on the site. Or one-time payment. Or advertising.
If the project is FOSS, it’s because their goal is not to have a good wage. Their goal is to have a job they enjoy and to have a product they want to have.
Technically, this may sound pedantic. You are not passing neither arrays nor tuples as generic parameter types.
What you are doing is passing an array to a function.
The type of the array is [i32;5]. Every value has a type.
By passing the array to a function, you are allowing the compiler to infer what function you are calling, since that function is generic. Using the type of the parameter you passed to it.
You can only pass values to function parameters. And you can only pass types as generic type parameters.
Well in this case it’s a little different, since it looks like you are passing a value (5) to a generic type parameter (LENGTH), but the
const
part ofconst LENGTH
means that it’s a value generic for a type, not a type generic for a type, which is the usual thing.EDIT: additionally, the
: usize
part tells you what type exactly the const parameter for the type has to be.Note that you can’t have non-const values as type parameters. Since types are defined at compile time.
EDIT 2: since type inference just fills some boilerplate for you. If we do that boilerplate manually it’s easier to see what parameters go where.
When you do
Buffer::from([0,1,2,3,4,5])
what you are really doing is:Buffer<i32, 5>::from([0,1,2,3,4,5)]
. In fact, if you put that, the code will compile exactly the same. Now if you put a 6 instead, it won’t compile since the type of the buffer and the type of the array you are passing are not the same.
calcopiritus@lemmy.worldto TechTakes@awful.systems•AI computers aren’t selling because users don’t careEnglish3·4 days agoYes. The ones that have power are the ones that decide. And oligarchs by definition have a lot of power.
You don’t need to know at all what optimizations will happen. I said that as an example of a thing that you know in compile time but not in run time.
To tell or not whether a type will be inferred is determined by you. If you tell the compiler the type, it will never be inferred. If you don’t tell the compiler the type, it will try to infer it. If it tries to infer the type but it fails, it will throw a compiler error and it won’t finish building the binary.
The compiler will only successfully infer a type if it has enough information at compile time to know with certainty what type it is. Of course, the compiler is not perfect, so it is possible in complex situations for it to fail even though it theoretically could.
Examples where inferring will succeed:
fn copy<T>(in: T) -> T { return in; } fn main() { let a = 47; //here a is of type i32, this was not inferred, it's just the default type of integer literals let b = copy(a); // here the compiler knows that a is i32, therefore it should call copy<i32>. Due to the type signature of copy<i32>, the type of b is inferred to be i32 let c: u16 = 25; // here instead of the default, we manually specify that the type of c is u16 let d = copy(c); // this is the same as b, but instead of calling copy<i32>, copy<u16> is called. Therefore d is inferred to be u16 let e = 60; // at first, this looks like a, and it should be the default of i32 let f: i64 = copy(e); // here, since f is specified to be i64, copy<i64> is called. Therefore e instead of being the default of i32, it is overridden since inference has preference over the default. e is inferred to be i64. }
Examples where inference will fail
trait Default { fn default() -> Self } impl Default for i32 { fn default() -> i32 { return 0 } } impl Default for i8 { fn default() -> i8 { return 0} } fn main() { let a: i32 = 8; let b = copy(a); let c: u8 = copy(b); // What type should be inferred to? If it calls copy<i32> because a is i32, then it can't call copy<u8> later to initialize c. And if it calls copy<u8> instead, it can't receive a as an argument since a is i32. Results in compiler error let d = Default::default(); // What type is d? both i32 and i8 implement the Default trait, each with its own return type. // let d: i32 = Default::default(); would compile correctly. }
These situations might be obvious, but inference works as a chain, sometimes hundreds of types are inferred in a single function call. So you should know the basics to diagnose these kinds of problems.
Who turned off starlink in Ukraine?
Nah, that would be programming with AI.
In vibe “coding”, you ask the AI for the code and just run it. If it doesn’t do what you want it to do, you just ask the AI again, or another AI. Ad infinitum.
Check the code yourself? That’s like 5th century pleb work, vibe “coders” would be wasting their precious time when they can just ask another AI to do it.
calcopiritus@lemmy.worldto TechTakes@awful.systems•AI computers aren’t selling because users don’t careEnglish7·5 days agoI they didn’t over promise, they wouldn’t have had mountain loads of money to burn, so they wouldn’t have advanced the technology as much.
Tech giants can’t wait decades until the technology is ready, they want their VC money now.
calcopiritus@lemmy.worldtoUnited States | News & Politics@midwest.social•It’s time for the US to guarantee healthcare to all24·5 days agoThe US can’t even guarantee keeping fascists away from the white house.
Since deadcream already told you the reason. I’m gonna explain a more generic way.
There are 2 important times: compilation time and run time.
At compilation time, everything that is constant, is known to the compiler, or can be calculated by it.
At run time, everything* is known.
Types have to be generated at compilation time**. This means that generics have to be also known at compilation time.
In this case. Both the “T” type of the buffer and its size “LENGTH” are generic, so they must be known at compile time. Compile time usually doesn’t know about vales of variables, except if those variables are “const”. Then it is known. A value literal is the same as a const variable.
So here, you provide a value literal ([0,1,2,3,4]) which is a fixed array, that is, both its “T” type (i32 by default) and length (5) are known at compile time. Buffer has all the information it needs to become a real type instead of a generic one. In this case, the type will be Buffer<i32, 5>
* Things that are optimized out at compile time are not known at runtime, but yes at compile time. For example:
const A: i32 = 5; const B: i32 = 5+1; fn main() { dbg!(B) }
Since A is never used (except to calculate B, which is const), A is probably optimized out. However, since B is used, there probably is a 6 somewhere in memory. Notice how I say probably since optimizations are optional. Or more optimizations may even remove the 6, and convert it to an ASCII “6” to be printed out.
**While this is always true trait objects (like Box<dyn ToString>) can act like some kind of runtime type, if you need that functionality.
I do use the home feed. Every time there’s a new release of a repo it shows up. And I follow the repos of my dependencies. So it is an easy way to be notified when one updates.
calcopiritus@lemmy.worldto Technology@lemmy.world•Windows 11 users reportedly losing data due to Microsoft's forcedWindows 11 users reportedly losing data due to Microsoft's forced BitLocker encryptionEnglish11·9 days agoBecause then you can’t change your password. Since you would have to decrypt all the hard drives that use windows with that account, and then encrypt them again with the new one.
This also means that if you forget your password you are fucked.
calcopiritus@lemmy.worldto Programming@programming.dev•Honest feedback- Would you use this?1·10 days ago- Office 365
- Google docs
- Libre office
- Confluence
All of those answer the questions. Sure, libre office for example relies on everyone knowing what MS office is, but it still does a good job of explaining.
Again, I don’t know exactly what your product does, but my guess is that confluence is the one that’s more similar.
Don’t need to look at your competitors though. Go to any product with a multi-million marketing budget and you’ll see how they answer the basic questions in a similar manner.
Edit:
Of course if you look at what their product page looked like before the AI bullshit ate the brains out of the tech CEOs, you would find better examples.
calcopiritus@lemmy.worldto Fediverse@lemmy.world•Chances for the fediverse? Elon Musk takes hit as Europeans ditch X in drovesEnglish1·10 days agoThat’s whataboutism.
There are many factors for the housing crisis.
That doesn’t mean that you can only solve one of the factors.
Just make a file system that maps each file name to 2 files. The 0 file and the 1 file.
Now with just a filename and 1 bit, you can have any file! The file is just 1 bit. It’s the filesystems that needs more than that.