More Zig Learning

Поделиться
HTML-код
  • Опубликовано: 4 сен 2024
  • LIVE ON TWITCH: / theprimeagen
    Become a backend engineer. Its my favorite site
    boot.dev/?prom...
    This is also the best way to support me is to support yourself becoming a better backend engineer.
    Get in on Discord: / discord
    Get in on Twitter: / theprimeagen
    Got Something For Me to Read or Watch??:
    / theprimeagenreact

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

  • @maxoumimaro
    @maxoumimaro 3 месяца назад +9

    Static reflection (the way you can iterate other the fields of structs) is useful for generic programming. For example if you want to print/serialize nested structs, you could just create a function in zig that would print/serialize any struct. This is very powerfull and very usefull. You can check the json functions in zig std library, in which you can read a json file into a struct containing all the fiel expected.

  • @heitorvrb
    @heitorvrb 2 месяца назад +3

    Try writing annotations in any language that support them. Reflection becomes a must

  • @TurtleKwitty
    @TurtleKwitty 3 месяца назад +3

    "I feel like I havent run into needing reflection ye" write a serializer/deserializer *cough* type safe json operations instead of dictionary and then manually moving things in/out of it *cough*

  • @andrewvalley4034
    @andrewvalley4034 14 дней назад

    Make sure zls is same version as zig if you're seeing language server issues.

  • @thisbridgehascables
    @thisbridgehascables 3 месяца назад

    Everything is more an object or array.

  • @himalczyk258
    @himalczyk258 3 месяца назад +2

    What is the file that is being worked on and can be learned zig ?

    • @ZenonLite
      @ZenonLite 3 месяца назад

      Ziglings. It’s on github

    • @vvarhand3985
      @vvarhand3985 3 месяца назад

      search for ziglings

    • @henryangeles2413
      @henryangeles2413 2 месяца назад +2

      It’s a set of exercises called ziglings

    • @himalczyk258
      @himalczyk258 2 месяца назад

      @@henryangeles2413thank you!

  • @brockdaniel8845
    @brockdaniel8845 3 месяца назад +8

    An error occurred. Please try again later. (Playback ID: sIXz23skee-sKSLa)

    • @i-am-linja
      @i-am-linja 3 месяца назад +1

      It's later, can I try again now?

    • @re_detach
      @re_detach 3 месяца назад

      @@i-am-linjano

    • @i-am-linja
      @i-am-linja 3 месяца назад

      @@re_detach :(

  • @guyblack9729
    @guyblack9729 3 месяца назад +10

    One minute and 0 views
    bro fell off

    • @abhinavrobinson2310
      @abhinavrobinson2310 3 месяца назад +6

      We are so back

    • @FlanPoirot
      @FlanPoirot 3 месяца назад +1

      same unoriginal comment as all the other bots
      bro fell off

    • @Matshiro
      @Matshiro 3 месяца назад +2

      @@FlanPoirot same unoriginal comment as all the other bots
      bro fell off

    • @i-am-linja
      @i-am-linja 3 месяца назад

      7 hours and 5 likes
      bro fell off

  • @isodoubIet
    @isodoubIet 2 месяца назад

    Forcing things that don't change to be const is awful because constness is a contract. Nothing should be incidentally const because it encourages people to rely on constness that may be incidental.

  • @i-am-linja
    @i-am-linja 3 месяца назад +2

    - I don't know how exactly you're thinking of pointers, but it's wrong. `*` and `[N]` are _independent_ type modifiers: (pointer to) (N contiguous) whatever. Auto-dereference lets you treat them like a unit, but that's a fiction. (I'm with you in not liking `*` == `*[1]`. I think that was a mistake.)
    - ZLS is a third-party project, with no official support from the ZSF. Given that, and that due to comptime it may have to execute arbitrary code to satisfy queries, it's actually remarkable how good it is.
    - Please never try to think about the bit representation of values again. That was painful to watch.
    - I will grant you, Ziglings does a poor job communicating what it is you're meant to do. I'm surprised at that.

    • @vvarhand3985
      @vvarhand3985 3 месяца назад +2

      Brother there’s a chill pill somewhere that you’ve forgotten to take

    • @i-am-linja
      @i-am-linja 3 месяца назад +1

      @@vvarhand3985 I am...confused. I wrote that comment with no emotion at all.

    • @vvarhand3985
      @vvarhand3985 3 месяца назад

      @@i-am-linja if so, then my bad. I mostly thought the comment about bit representation is unwarranted, he is learning after all

    • @i-am-linja
      @i-am-linja 3 месяца назад +1

      @@vvarhand3985 Ok, yes, I will concede that bit has an electrostatic charge. I do have a tendency to get frustrated at mistakes/misunderstandings in things I wouldn't even think to elaborate in an explanation. They set off from the wrong place following the wrong map, and I'm trying to pinpoint the exact coordinates where they diverged from the path.