Pascal Hertleif - Writing Idiomatic Libraries in Rust

แชร์
ฝัง
  • เผยแพร่เมื่อ 23 พ.ย. 2024

ความคิดเห็น • 40

  • @CarrotCakeMake
    @CarrotCakeMake 5 ปีที่แล้ว +68

    That point about the booleans was very insightful.

  • @flokkq7931
    @flokkq7931 3 หลายเดือนก่อน

    Been using rust for around 8 months now and i gotta say the bools shocked me. This is a great talk

  • @neilconway6614
    @neilconway6614 5 ปีที่แล้ว +10

    A concise best practices guide for new rust programmers (and probably experienced ones too). Thank you for creating this.

  • @moominfin
    @moominfin 6 ปีที่แล้ว +31

    I read "stringly typed" in the thumbnail as "strictly typed" and was worried he was going to argue against enums such as the ones at 13:00 , which I absolutely love
    Good stuff, to hell with booleans!

    • @simonmaracine4721
      @simonmaracine4721 4 ปีที่แล้ว +9

      I read "strongly typed" and I was even more worried, because I dislike weak typing.

    • @MisterComment25
      @MisterComment25 3 ปีที่แล้ว +1

      Thanks for pointing that out 😅 I made the same mistake and immediately clicked the video

  • @builderchad1
    @builderchad1 4 ปีที่แล้ว +8

    Some voices like Pascal's are well suited to this format. I found this easy to follow and useful, thank you for posting.

  • @Tantandev
    @Tantandev 4 ปีที่แล้ว +13

    This is a golden nugget, Great talk!

  • @cauebs
    @cauebs 7 ปีที่แล้ว +31

    I have only recently started learning Rust, so this is really useful. Also, it's awesome that many of these apply to Python as well!

  • @edgeeffect
    @edgeeffect 4 ปีที่แล้ว +13

    8:26 - OK, I'm talking PHP here, but the exact opposite of this was presented to me a few years ago when I was working on a project that foolishly used Wordpress.
    Every file seemed to start with *error_reporting(E_NONE);* ....... of course, I changed this to *error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);* so I could find *my* errors....
    And the *massive* stream of errors that spewed from the "libraries" is a clear explanation of why what Pascal says is right.

  • @ChristopheTroestler
    @ChristopheTroestler 2 ปีที่แล้ว +1

    Nice talk. A trait that is not implemented often enough is the `Error` one... 😀

  • @sardobi
    @sardobi 2 ปีที่แล้ว +2

    I'm somewhat new to Rust - at 18:45 the speaker mentions adding new trait implementations potentially being a breaking change. Why is that? Is it because method calls which were previously unambiguous might be made ambiguous? (E.g. if a library user wrote their own trait with a `fmt` method and then you implemented `Display`)

    • @proloycodes
      @proloycodes 2 ปีที่แล้ว +2

      you are correct.

  • @lwouisYT
    @lwouisYT 7 ปีที่แล้ว +19

    Such a friendly attitude! Great content too :)

  • @DarkDog09
    @DarkDog09 7 ปีที่แล้ว +5

    Really interesting ideas, will definitely keep some of these tips in mind!

  • @steveharris3627
    @steveharris3627 4 ปีที่แล้ว +1

    Session types seem neat for Fluent APIs

  • @jocjoc5587
    @jocjoc5587 2 ปีที่แล้ว

    Best Rust talk I've seen

  • @yapayzeka
    @yapayzeka ปีที่แล้ว

    26:38 I can give an example. if you implement Display trait you will get to_string() function for free because Display is a blanket implementaion for ToString trait.

  • @ShaderKite
    @ShaderKite ปีที่แล้ว

    Great talk! Thanks TH-cam for recommending it to me after 5 years xd
    Shame it had to be ended prematurely due to lunch though ;p

  • @andersmusikka
    @andersmusikka 7 ปีที่แล้ว +4

    Great talk! Entertaining and informative!

  • @Yassinebridii
    @Yassinebridii 4 ปีที่แล้ว

    This is such a useful talk.

  • @ProCoder2007
    @ProCoder2007 6 ปีที่แล้ว

    Very cool talk! Many thanks! :)

  • @yapayzeka
    @yapayzeka 2 ปีที่แล้ว

    this is gold

  • @Lavasea
    @Lavasea 3 ปีที่แล้ว

    Great talk!

  • @michaelw9852
    @michaelw9852 4 ปีที่แล้ว

    Good talk!

  • @YourCRTube
    @YourCRTube 4 ปีที่แล้ว +2

    Rust selling C++ ideas. I am not complaining.

    • @kebien6020
      @kebien6020 4 ปีที่แล้ว +4

      Yeap. A lot of the advice here applies to C++.
      Prefer enum (class) over strings and booleans.
      C++ has default parameters but not named parameters, so the advice about the builder pattern applies for the same reason.
      Use (and abuse) the type system to disallow (at least some of the) incorrect programs from compiling.
      Use implicit conversions to make APIs nicer (C++ goes a bit overboard with this, because explicit constructors are opt-int and not the other way around).
      And I swear I've head the phrase "what would std do?" at some point in some cppcon talk.

  • @Siniverisyys
    @Siniverisyys 4 ปีที่แล้ว

    Has anyone disassembled Rust code? Would "session types" cause extra code?

    • @YourCRTube
      @YourCRTube 4 ปีที่แล้ว +1

      Of course, there will be extra code, with the hope the optimizer will vaporize it.

    • @SolomonUcko
      @SolomonUcko 4 ปีที่แล้ว +2

      You can try experimenting with rust.godbolt.org/.

  • @ErikBongers
    @ErikBongers 2 ปีที่แล้ว +6

    I'm half way watching this video and I just noticed the upper left corner. "2017, Kyiv, Ukraine". Ukraine is in the middle of war now. Surreal.

  • @rolandrodriguez
    @rolandrodriguez 3 ปีที่แล้ว

    Excellent thx