snaggen

joined 2 years ago
25
submitted 2 years ago* (last edited 2 years ago) by snaggen@programming.dev to c/rust@programming.dev
 

If you are using Rust for web or considering doing so, you might be excited to hear that rustls merged a PR to make ring an optional dependency. Soon(-ish) you will be able to choose which cryptography backend to use with rustls, including one written fully in Rust. That would help with making your projects easier to build. Big thank you to rustls team, including Joe Birr-Pixton, @djc, and @cpu!

https://github.com/rustls/rustls/pull/1405

 

This 3-day conference by & for the #rustlang community will begin with an add-on workshop day, followed by two days of talks and an unconference day on Friday. Learn more and register to join us remotely: https://rustconf.com/

 

TL;DR - Use std::slice::Chunks when you'd like to measure a slightly more accurate execution time of each future in a big batch of futures.

[–] snaggen@programming.dev 13 points 2 years ago

There is no dedicated learnrust forum here yet, so post your questions here, and if it becomes a problem it can be handled then (by creating a learnrust commynity).

[–] snaggen@programming.dev 15 points 2 years ago (4 children)

The core problem I see with Inheritance is that the abstractions tend to fall apart and no longer be true. Lets use the Animal example. It is easy, when you have Animal -> Cat and Animal -> Dog. But as soon as we become more specific like Animal -> Mammal -> Cat, Animal -> Fish -> Hammerhead Shark, Animal -> Bird -> Bald eagle, we risk of getting in trouble. Because now for all purposes we assume things about the Fish, Birds and Mammals, like fish is in the sea and mammals are live on land. We know that this is not strictly true, but for everything we need it works. Later we need to handle a dolphin.... should that be a fish, or do we need to restructure the whole program. If we treat it like a fish, then we might be even deeper in trouble later if we would need to handle birth. And even if we restructure our program to be correct to handle birth, we might stil forget that some mammals lay eggs like the Platypus, so then things break again if we need to handle that. We tend to see Inheritance as a rigid fact based structure, but the core problem is that it is just a bunch of assumptions we dictate in a very rigid way that is hard to change.

Composition have no problem with specifying the platypus as a mammal that lays eggs and have a beak.

[–] snaggen@programming.dev 3 points 2 years ago

Oh, that was a great site. Thanks for posting.

[–] snaggen@programming.dev 5 points 2 years ago

That is pretty much the same policy I have for forcing adds on me.

[–] snaggen@programming.dev 2 points 2 years ago

Yes, I was surprised when I noticed the length of it.

[–] snaggen@programming.dev 3 points 2 years ago

Just to be clear, I'm not the author I just found it a quite interesting article and thought I'd share it here.

[–] snaggen@programming.dev 3 points 2 years ago

Well, Sync for Reddit is basically being kicked off Reddit, so a new app is being created to work with Lemmy. Of course it is in the app developers interest to promote the new applicataion, and from what I understand they plan to do so by adding a popup to sync informing them of the new Sync for Lemmy application. And if they are pointing Reddit users to Lemmy, it is only logical that they want the users to be able to easy find their place and find the communities of interest... so i don't understand why they should not do that. What you are saying is that they should not try to make any users use their new app they have spent time developing, and that just doen't make any sense. But I agree that they should not promote any particular instance or specific community, which is why I pointed to services that list all instances and makes it easy to find a suitable instance, and makes it easy to find communities that matches any particular subreddit.

[–] snaggen@programming.dev 4 points 2 years ago

Having programmed in C, I got the ownership model quite fast. I just think of it as "is this function going to do an implicit free on return", if not then it should just borrow it. And for C, you already had to think of ownership, just that it was not enforced in any way in the language... if you messed up the ownership to either got a crash or leak.

[–] snaggen@programming.dev 21 points 2 years ago (20 children)

To be fair, he merged the original version and not his own.... at least not yet until it have been properly tested.

[–] snaggen@programming.dev 2 points 2 years ago (2 children)

Yes, I started off with a C mindset and had a bit of a struggle the first days until the mental model of ownership and borrowing landed, after that it is mostly learning to use new concepts like pattern matching, the ? operator aso.

[–] snaggen@programming.dev 2 points 2 years ago

Wouldn't even have thought of it, if you hadn't mentioned it... but it is a neat feature.

[–] snaggen@programming.dev 4 points 2 years ago

Just to be clear, I'm not the author of the article. I just found it on the Internet and found it interesting.

view more: ‹ prev next ›