When to use Pointers in Go w/ Practical Example - Heap/Stack, Pointer Receiver

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

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

  • @dhij
    @dhij  2 года назад +6

    0:00 Intro - Stack & Heap; How it is different in Golang
    0:30 Common idea of pointers; Why passing pointers in Go is often slower than passing values
    1:13 Understanding Allocations: the Stack & the Heap (GopherCon presentation by Jacob Walker)
    2:00 How Go typically stores variables in the stack vs. heap
    3:10 Visualization of stack - a scenario where stack will not work
    4:02 Summary of Understanding Allocations
    4:48 4 different use cases of pointers in Go
    5:18 Overview of code example
    6:39 An example of "sharing up" the pointer to the User struct (stored in the heap)
    7:56 Case 2 & 3: Mutability of the receiver function & Consistency
    9:21 Case 4: Signify true absence (make a nullable variable)

  • @apidas
    @apidas 2 года назад +2

    great video. appreciate the sharing

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

      Appreciate it!

  • @antonjatula8421
    @antonjatula8421 Год назад +1

    Thank you for making this video :) Superbly explained and insightful examples!

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

      Appreciate it!!

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

    Thank you for explaining !!!

  • @VIKTOR-pw8eu
    @VIKTOR-pw8eu Год назад

    Came to your channel after watching your chat app tutorial (btw tutorial is awesome). This video is so much useful and it helped me understand your architecture approach. Thank you so much and keep it up!

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

      Glad that helped!!