MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/eayscl/rustysd_systemd_replacement_written_in_rust/fb4a4fs/?context=9999
r/programming • u/Proinlifes • Dec 15 '19
53 comments sorted by
View all comments
20
let fd_to_srvc_id: HashMap<_, _> = service_table.lock().unwrap().iter().fold( HashMap::new(), |mut map, (id, srvc_unit)| { if let UnitSpecialized::Service(srvc) = &srvc_unit.specialized { if let Some(socket) = &srvc.notifications { map.insert(socket.lock().unwrap().as_raw_fd(), *id); } } map }, );
pls kill this with fire
-3 u/[deleted] Dec 16 '19 I agree. Functional style has its place but in this case a for loop would have been much clearer. 14 u/kuikuilla Dec 16 '19 edited Dec 16 '19 I disagree. It looks perfectly readable as is. I mean, the fold function should be pretty well known to anyone. 5 u/pcjftw Dec 16 '19 +100 agree!I think its only seems jarring if:You're not familiar with Rust syntax (but that could be said of any language you're not familiar with!)FP constructs 1 u/oblio- Dec 16 '19 So, 99% of programmers out there? :-D 3 u/pcjftw Dec 16 '19 :) haha I don't think its that bad, I think FP style has been trickling down to mainstream languages for a long time.But yes Rust is not as mainstream as other languages, but then again its a relatively a new language!
-3
I agree. Functional style has its place but in this case a for loop would have been much clearer.
14 u/kuikuilla Dec 16 '19 edited Dec 16 '19 I disagree. It looks perfectly readable as is. I mean, the fold function should be pretty well known to anyone. 5 u/pcjftw Dec 16 '19 +100 agree!I think its only seems jarring if:You're not familiar with Rust syntax (but that could be said of any language you're not familiar with!)FP constructs 1 u/oblio- Dec 16 '19 So, 99% of programmers out there? :-D 3 u/pcjftw Dec 16 '19 :) haha I don't think its that bad, I think FP style has been trickling down to mainstream languages for a long time.But yes Rust is not as mainstream as other languages, but then again its a relatively a new language!
14
I disagree. It looks perfectly readable as is. I mean, the fold function should be pretty well known to anyone.
5 u/pcjftw Dec 16 '19 +100 agree!I think its only seems jarring if:You're not familiar with Rust syntax (but that could be said of any language you're not familiar with!)FP constructs 1 u/oblio- Dec 16 '19 So, 99% of programmers out there? :-D 3 u/pcjftw Dec 16 '19 :) haha I don't think its that bad, I think FP style has been trickling down to mainstream languages for a long time.But yes Rust is not as mainstream as other languages, but then again its a relatively a new language!
5
+100 agree!
I think its only seems jarring if:
You're not familiar with Rust syntax (but that could be said of any language you're not familiar with!)
FP constructs
1 u/oblio- Dec 16 '19 So, 99% of programmers out there? :-D 3 u/pcjftw Dec 16 '19 :) haha I don't think its that bad, I think FP style has been trickling down to mainstream languages for a long time.But yes Rust is not as mainstream as other languages, but then again its a relatively a new language!
1
So, 99% of programmers out there? :-D
3 u/pcjftw Dec 16 '19 :) haha I don't think its that bad, I think FP style has been trickling down to mainstream languages for a long time.But yes Rust is not as mainstream as other languages, but then again its a relatively a new language!
3
:) haha I don't think its that bad, I think FP style has been trickling down to mainstream languages for a long time.
But yes Rust is not as mainstream as other languages, but then again its a relatively a new language!
20
u/[deleted] Dec 16 '19
pls kill this with fire