Cursed Rust

(paper.wf)

18 points | by todsacerdoti 17 hours ago ago

7 comments

  • davidatbu 7 hours ago ago

    I don't know if it's due to my familiarity with Rust, but I find none of the examples cursed or surprising, except the "&* is useful" one. Even for that one, I think the use case of "turning a raw pointer to a reference" actually requires unsafe, and so it's imo a bit misleading to omit that fact.

    All this is unlike a language i work with in my day job (and hence one would expect that I'd not find surprising), and yet I find so much behavior utterly baffling: https://dev.to/ben/what-is-the-oddest-javascript-behavior-4d...

    • ramon156 6 hours ago ago

      I guess the "cursed" part is that developers can make unexpected behavior happen, but what's the point? No one's gonna purposefully make a bad clone/copy.

  • dabacaba 16 hours ago ago

    In Rust, if expressions are not place expressions. In the example, arr_ref is a reference to a temporary, not to an array element. In Rust, it is possible to take an address of any expression, but taking an address of a value expression will produce an address of a temporary.

    • John23832 3 hours ago ago

      Interesting. Is there any documentation which explains this?

  • atoav 7 hours ago ago

    #00F on black is really not a color combination anybody should use in any case where accessability matters.

  • desdenova 5 hours ago ago

    Cursed article by someone who doesn't know Rust.