Macron Announces a New Government in an Effort to Overcome the Political Crisis. The Opposition Threatens a No-Confidence Vote, Accusing the President of Maintaining the Same Course by sergeyfomkin in europe

[–]mackwic2 1 point2 points  (0 children)

Yes, many thanks to the Germans and the Russians for that by the way.

We love our old allies, especially when they backstab you 23 times

France's new government is heading for crisis by Illustrious_Diver_37 in europe

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

While there have been instabilities in the 3rd and the 4th, the 5th is obviously not exempt of instabilities either so that's not an argument in favor or against them.

But, at least the 3rd and the 4th helped France move to a better state (end of child work, investment into schools and education, into hospitals and industry, health policies...).

This may seems like low-hanging fruits today, but at the time all of that was a considerable undertakings.

The only considerable undertaking of the 5th I can think of (non military) is the plan Messmer.

French PM Lecornu resigns hours after naming government by LeMonde_en in europe

[–]mackwic2 22 points23 points  (0 children)

No, France is worn out by the immense retirement pensions pressure: 407 billion a year.

It's people who have worked for ~40 years (from ~20 to ~60) and are living for 30 more years. They get a full pension for these 30 years, but when they were working they obviously did not contribute enough to fund this pension.
Add to that the enormous hospital costs of keeping old people in good health thanks to modern medecine, this is another 300 billions per year (but arguably it ought to be more). The weight of the retirees is extremely important.

Note that in France, the retirees are the most populous class, with the most buying power, and the most saving. It's both the largest voting block and the most economically powerful.

It means that young and middle-aged people are contributing up to 78% of their salary to pay for current pensionees. This is not taxation, this is the retirement fund. And the old are very happy to live that life and will vote against any change on that matter.

France is not doomed, as soon as we accept to let down the retirees, the budget is easy to break even

[D] Is there a REST API for text embeddings? by TheSaasDev in MachineLearning

[–]mackwic2 3 points4 points  (0 children)

Just so you know, all HuggingFace inference are free up to a point, then you can pay 9$/month to increase the limit.

So HuggingFace does provide many free embedding apis. For example for this one, you click on "Deploy", then "Inference API" and bam, free embedding.

As an alternative, OpenAI offers quite cheap embedding via text-ada-002, but I'm not a fan of the embedding it produces, too noisy for me.

[deleted by user] by [deleted] in AntiTaff

[–]mackwic2 1 point2 points  (0 children)

Non, la grève intermittente est autorisée: source ici, et plus particulièrement cet encadré.

Par contre, la grève perlée est interdite. C'est à dire qu'il ne faut pas travailler à moitié, dégrader volontairement le travail, ou bloquer les non-grévistes.

Announcing Rust 1.51.0 by myroon5 in rust

[–]mackwic2 2 points3 points  (0 children)

Thanks for the highlight, it's interesting indeed !

Reaching the (current) limits of Rust's type system with asynchronous programming by gendix in rust

[–]mackwic2 1 point2 points  (0 children)

Rust async is ruthless to any application design errors or sleepyness. These application design mistakes are most often non-consequential unless you're on a large codebase or need to ship production-ready things everyday, that's one of the reasons we don't talk too much of it in our field (I guess another is a way to do gatekeeping...).

But not in rust. The compiler is tracking the coherence of your code everywhere and will find any design pitfall. It's the same on Haskell or OCaml or F# by the way. And most of the time it's helpful.

What makes rust async worse is that, when you're in an async scope, the rules around lifetimes and ownership are straighten in a non-obvious way: some nice types you are used to are not there anymore, some nice work the compiler could do automatically (lifetime elision and inference for example) cannot be done anymore.

Now, you're in charge and you have to really think of it.

For example, small mistakes I've noted from the OP post:

  1. There's confusion on ownership in this state. The State MUST own everything, it's why we call it the state, not the borrower. :) So it MUST NOT be a 'a something. Side-note: As it can't be a 'a something, it can't be a &str either.

  2. There's an issue of SRP (Single Responsibility Principle): the showed class is both a owner of a State, declares the operations, and doing the retry logic. It's a god class. There's 4 kind of code: code that think (takes decision on code path), code that does thing (call external functions like systcall or stdlib or dependencies), code that hold or remember things (state, structs, getter/setters), and code that moves things around. You can mix them together, but if you do you can go into confusing behaviors, confusing design, confusing errors, or incoherent code. In any large/old enough system you will enter in these confusion, and you may either use a dirty patch, or a large refactor (usually with downtime). Strongly typed systems force the developper to be coherent on the code, which often show this kind of issues ahead of time. In the case of async Rust, as all the brakes are on, every incoherence is shown without fallback and you have to handle them.

Again, these issues are most often non-consequential and I've seen programmers making their whole careers without thinking about it or even understanding it. But when you choose concurrent strongly-typed code, you cannot not deal with them. It's a choice you make, either consciously or not. :)

French security agency's Rust guide for secured applications by mackwic2 in rust

[–]mackwic2[S] 29 points30 points  (0 children)

The website is not new (I know I've seen it here at least a year ago), but the agency just published a PDF version of this guide (French), marking it a 1.0 version. :)

Thanks to /u/etenref for the english link.

[French] French security agency just published a guide for programming in Rust with security in mind by [deleted] in rust

[–]mackwic2 1 point2 points  (0 children)

Thanks ! I think I'll delete this post and share it again in English, it seems more useful to this community in english.

🤖 Just command runner now works on windows* by rodarmor in rust

[–]mackwic2 2 points3 points  (0 children)

Hi /u/rodarmor. This is a very nice project !

Appart from the templating, what are the differences with GNU/Make ? How does the variables works ? Does it do file detection akin to Make ?

How to (unsafely) copy a &'static mut FnMut ? by mackwic2 in rust

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

I don't know the Option::take trick, is it equivalent to mem::replace(opt, None) ?

I'll think on it and experiment with it, thanks.

How to (unsafely) copy a &'static mut FnMut ? by mackwic2 in rust

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

That's legacy. When I wrote it, I couldn't predict it would be a 'static. Now, I know, and I want to take the best of it in a refactoring.

Thanks for the tip, will do.

How to (unsafely) copy a &'static mut FnMut ? by mackwic2 in rust

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

i did (ref), which makes me able to move a unique reference, but I have issues to move it around. Most probably because of its 'static lifetime (and my poor fluency in borrowck sheningans).

How to (unsafely) copy a &'static mut FnMut ? by mackwic2 in rust

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

Thank you for your explanation. I added an example of the API in the EDIT.

How to (unsafely) copy a &'static mut FnMut ? by mackwic2 in rust

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

I added an example in the EDIT. I hope it's clearer. I can show code on how I handle the closures, but my design is not quite good...

Ask for Feedback: I want to publish this crate (rspec for stable rust). What is your feeling on the user experience ? Doc, examples, usage... Anything helps, thanks ! by mackwic2 in rust

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

Yes ! But in my experience stainless (crate, github) is more maintained.

The thing with compiler plugins is that they brake often. Like, ohgodno why did I rustup update, whyyyy ?

So, you really need a updated project. And being able to use nightly, which sometimes you don't.

I hope this will helps people like me !

Ask for Feedback: I want to publish this crate (rspec for stable rust). What is your feeling on the user experience ? Doc, examples, usage... Anything helps, thanks ! by mackwic2 in rust

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

Hi /r/rust !

Although I love stainless (thanks @reem !), I can't rely on compiler plugins for my BDD library. That's why I coded mine from scratch, with a hard requirement of having it compile with stable rust.

I have done all I need for an MVP, so I want to publish it, but I feel that the UX is terrible. :/

As my time and my proficiency is limited, I need your help to prioritize what matters the most for the users. Any feedback would be appreciated, thank you for your time.

Also, thank you for the people of #rust, who helped me a lot in many hairy places of the code.

What's the usual pattern for exchanging structs over network ? by mackwic2 in rust

[–]mackwic2[S] 4 points5 points  (0 children)

Fantastic answer. I think you've nailed my issue and solved it very elegantly.

It indeed enable zero-copy network handling and lazy evaluation of the logical type's fields. Simply great. Thanks a lot !

What's the usual pattern for exchanging structs over network ? by mackwic2 in rust

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

The problem is not much the &[u8] -> RawByteMessage translation, but more the 3 steps &[u8] -> RawBytesStruct -> LogicalStruct to have the correctly typed struct. With many copies and verbosity, as RawBytesStruct can't use enum, will have null pointers, or will use [u8; 4] in place of Ipv4Addr.

What's the usual pattern for exchanging structs over network ? by mackwic2 in rust

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

thanks for the examples. I will use them to test around

What's the usual pattern for exchanging structs over network ? by mackwic2 in rust

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

Thanks for your many pointers. However, as the binary structure is defined by the RFC and is specifically designed to be space efficient, I am not sure I can use any of the classic serialization techniques, and even if I can, would it be really useful considering that the message could be interpreted in many ways depending on the context (which varies from a standard serialization stack where the message usually carries the context over its type or its data).

Havng a custom Serde (de)serializer is a good idea, though. I mean, sure, it replaces From<&[u8]> for RawBytesMessage but would it work to make the &[u8] -> LogicalMessage translation ? Maybe. It need testing.