[Dlang Episode 98] D Language - static assert - catch errors at compile-time

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

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

  • @twenty-fifth420
    @twenty-fifth420 4 месяца назад +1

    6:15 I might have missed this from other courses, but can struct be anycase. Are these valid? structure, struct_ure, strucTure?
    Yes, I admit, I am not creative. It is six in the morning and I have no coffee. I am aware D has a mechanism like Nim for creating an escape with keywords, I believe it uses ```
    But this I did not know. I always assume PascalCase for udts. That is good to know, but I could be wrong.
    Anyway, to the actual lesson at hand. Say I wanted to model a character sheet, I assume I can use static asserts for the struct field. Like for example how in DND, you cannot have a certain number of skills and you have a hard max at level 20.

    • @MikeShah
      @MikeShah  4 месяца назад

      Yup, can use static asserts for that. There's also contracts for structs as well (in and out) to enforce these guarantees when testing for instance.

  • @bsdooby
    @bsdooby 4 месяца назад +1

    Is being a YT channel member a good way to support you, @MikeShah? Or is Patreon or a one-time contribution better suited?

    • @MikeShah
      @MikeShah  4 месяца назад

      That's very kind! Folks are welcome to become members at any level or do super thanks (one-time). I understand folks financial situations are all different, so comments, likes, and engaging in the community are also perfectly fine.
      I don't have patreon, as I figured folks might want to just keep everything on RUclips.

  • @Chupe_chupe
    @Chupe_chupe 4 месяца назад +1

    Great video Mike

    • @MikeShah
      @MikeShah  4 месяца назад

      Cheers! You are most welcome!