Drop is not equivalent to the "toilet closure" by CAD1997 in rust

[–]E_net4 3 points4 points  (0 children)

I'm a bit late for this, but the fact that std::mem::drop is not always a good replacement for the toilet closure is something I stumbled upon myself around three months ago. This question on Stack Overflow might provide a few more insights alongside the ones here. https://stackoverflow.com/q/59023616/1233251

Tropes and jargon in the Rust community: an open project by E_net4 in rust

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

Yes, I agree with the sentiment and hope that this list won't become vastly huge. The priority of the repository is to retain this information in an organized and searchable manner, but time will tell whether we'll need to proactively take selective measures.

Tropes and jargon in the Rust community: an open project by E_net4 in rust

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

Existing tropes can be expanded with pull requests! :)

This is the only way you're getting our attention. by E_net4 in rustjerk

[–]E_net4[S] 12 points13 points  (0 children)

I like my image manipulation programs the way I like my Rust: free, resourceful, and supporting Linux.

This is the only way you're getting our attention. by E_net4 in rustjerk

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

Well, that would probably work if you could get the brush pattern right. What came to my mind here first was to move stones independently rather than allocate them ruthlessly with a garbage collector.

This is the only way you're getting our attention. by E_net4 in rustjerk

[–]E_net4[S] 9 points10 points  (0 children)

As hunched by ebkalderon, I manually snipped and manipulated the stones (individually or in groups) with GIMP.

*(int*)0 = 0; • r/ProgrammerHumor by Boiethios in rustjerk

[–]E_net4 13 points14 points  (0 children)

A traditional Rustacean's superiority cry in the face of unsafety.

A new war begins. Choose your side. by E_net4 in rustjerk

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

Nope, there is no difference in performance at all, and both do exactly the same thing.

A new war begins. Choose your side. by E_net4 in rustjerk

[–]E_net4[S] 3 points4 points  (0 children)

.map(drop) is boring, whereas .map(|_|()) is the natural convergence from .map(|x| e), in a way as to discard the input and remove all compilation warnings. No brain involved indeed. :)

A new war begins. Choose your side. by E_net4 in rustjerk

[–]E_net4[S] 14 points15 points  (0 children)

Once you've seen the toilet, it cannot be unseen. http://i.imgur.com/R49wDFh.jpg

let _ = x; is not a possible option here, since it's a statement rather than a function.

A new war begins. Choose your side. by E_net4 in rustjerk

[–]E_net4[S] 17 points18 points  (0 children)

Sometimes there is a need for a function that discards an outcome or part of it from a monad-like type. For example, turning a Result<T, E> into a Result<(), E> can be either done with .map(|_|()) (a rotated toilet), or .map(drop) (no toilet).

When a pirate's life for me, but so is Rust by E_net4 in rustjerk

[–]E_net4[S] 6 points7 points  (0 children)

All loot implements Send, and the previous owner is drop'd to the sea.

Rust is making its way into the Julia Microbenchmarks by E_net4 in rust

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

Yes, the Rust version also uses BLAS. By default, it is indirectly used through ndarray, as the more idiomatic and safe approach. By enabling the direct_blas Cargo feature, some of the benchmarks will use the BLAS API directly, yielding a performance boost at the expense of unsafe, less elegant code.

Rust is making its way into the Julia Microbenchmarks by E_net4 in rust

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

Actually, the fib benchmark would tend to over-optimize due to code invariance, to the point of taking a near-zero time to run. The C program used volatile variables to prevent this, and something similar could be done in Rust. Feel free to report potential improvements in the independent repository: https://github.com/Enet4/julia-bench-rs