snaggen

joined 1 year ago
 

Traits now support async fn and -> impl Trait (with some limitations), the compiler got faster, version = in Cargo​.toml is now optional, and many small functions have been stabilized!

[–] snaggen@programming.dev 4 points 1 year ago* (last edited 1 year ago) (1 children)

In the annoying popup, there is a cog wheel, clicking that will show a menu. That menu have a checked checkbox, Always offer to translate, uncheck that.

[–] snaggen@programming.dev 1 points 1 year ago

Yes, you have a point. However adding heat is often implicit when talking about melting stuff. However, if it requires 3400C, then the answer would probably include a comment about that.

[–] snaggen@programming.dev 10 points 1 year ago* (last edited 1 year ago) (3 children)

Well, I agree. But what I mean is that when people ask physics questions, it is often implicitly understood to mean under current conditions. You rarely hear normal people or kids (who I find asks most of the physics question) include anything about frictionless vacuums in the question. (For reference: https://xkcd.com/669/ ). So, for the egg question, regular people would most likely consider the answer to be "No, except under very special circumstances". But, I agree with you that if a simple Yes/No answer is expected, it have to be Yes.

[–] snaggen@programming.dev 21 points 1 year ago (5 children)

Well, for eggs, that are carbon based, you will in fact have problems since carbon doesn't have a liquid state at regular atmospheric pressure. I guess you can add pressure, but is that really what we mean when asking a question if something melt?

[–] snaggen@programming.dev 4 points 1 year ago (2 children)

It might be interesting to watch the Jackie Chan episode of Every Frame is a Painting, for an analysis of the difference between Hollywood and Hong Kong. This will explain why Jackie Chan is so much better in his Hong Kong movies.

https://m.youtube.com/watch?v=Z1PCtIaM_GQ

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

That is all dependent on the program, but the simplest scenario is by an API with two requests at the same time. But it may also be like if you scan for new files, and use inotify, then you may also have a scanning loop as a fallback. Then the scan and inotify may trigger at almost the same time, so if that then results in a db create or insert you can get in to this problem. So, there are multiple ways to get in to trouble, and life always find new ways 😀

[–] snaggen@programming.dev 4 points 1 year ago

You are free to see this as an ad, but as Rust is targeting safety critical programming in general, I find it interesting to follow certification efforts like this to make rust available for really safety critical use cases. Now, the Ferrocene project is contributing back, but that fact or the license does not really affect the relevance for this community.

[–] snaggen@programming.dev 11 points 1 year ago (7 children)

Well, of course you should stick to rustc if you don't need the certification. I get the impression you mix up thing and the purpose of a certified compiler.

Ferrous Systems is working on certifying a specific version of rustc, and hence make it possible to use rust for projects where such certification is required. And certification is required for things like programming medical equipment. If you are hooked in to life support, it is good if the compiler did the thing it was supposed to do.... a crash in such programs can be fatal in a very literal way.

Also, notice that they try to do this without forking and by contributing upstream.

[–] snaggen@programming.dev 3 points 1 year ago (2 children)

As I still run in to glibc version issues a little now and then (admittedly not very often, thankss to containers), I hope to see rust getting rid of libc one day. But I don't expect that in the near future, because as the author mentions, libc is very mature, so replacing it must be done with a lot of caution. But this really looks like a step in the right direction.

[–] snaggen@programming.dev 7 points 1 year ago (2 children)

I think this is was a great read, since it shows a few important things

  • Coming to rust from C is not trivial, you are required to learn a few new concepts (or not really new, but implicit in most languages, formalized in rust).
  • When coming from C and you understand the basic concepts, it is easier to learn rust than from many other languages, since you understand what is going on under the hood. Dangling pointers, and use after free aso, are known concepts. C/C++ programmers don't have to fear rust.
  • The rust book is a great source of information.
[–] snaggen@programming.dev 2 points 1 year ago

So, a loop it is....

[–] snaggen@programming.dev 4 points 1 year ago (5 children)

That will always be prune to race conditions, where you check if someting exists (then some other thread creates it) and then you try to create it. You should always try to create first, then if it fails due to it already existing, fetch it. That is a good general rule for anything from hashmaps to databases.

view more: ‹ prev next ›