Pascal Hertleif - Writing Idiomatic Libraries in Rust

Поделиться
HTML-код
  • Опубликовано: 15 янв 2025

Комментарии • 40

  • @CarrotCakeMake
    @CarrotCakeMake 5 лет назад +68

    That point about the booleans was very insightful.

  • @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

  • @neilconway6614
    @neilconway6614 6 лет назад +10

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

  • @Tantandev
    @Tantandev 4 года назад +13

    This is a golden nugget, Great talk!

  • @flokkq7931
    @flokkq7931 5 месяцев назад

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

  • @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.

  • @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!

  • @lwouisYT
    @lwouisYT 7 лет назад +19

    Such a friendly attitude! Great content too :)

  • @sardobi
    @sardobi 3 года назад +3

    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`)

    • @mojacodes
      @mojacodes 3 года назад +2

      you are correct.

  • @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.

  • @DarkDog09
    @DarkDog09 7 лет назад +5

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

  • @ChristopheTroestler
    @ChristopheTroestler 2 года назад +1

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

  • @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.

  • @steveharris3627
    @steveharris3627 4 года назад +1

    Session types seem neat for Fluent APIs

  • @ShaderKite
    @ShaderKite Год назад

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

  • @Yassinebridii
    @Yassinebridii 4 года назад

    This is such a useful talk.

  • @andersmusikka
    @andersmusikka 7 лет назад +4

    Great talk! Entertaining and informative!

  • @ProCoder2007
    @ProCoder2007 6 лет назад

    Very cool talk! Many thanks! :)

  • @yapayzeka
    @yapayzeka 2 года назад

    this is gold

  • @Lavasea
    @Lavasea 3 года назад

    Great talk!

  • @michaelw9852
    @michaelw9852 4 года назад

    Good talk!

  • @rolandrodriguez
    @rolandrodriguez 3 года назад

    Excellent thx

  • @Siniverisyys
    @Siniverisyys 5 лет назад

    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.

  • @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.