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

Поділитися
Вставка
  • Опубліковано 27 жов 2024

КОМЕНТАРІ • 8

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

  • @thanhduongphan315
    @thanhduongphan315 Рік тому

    Thank you for explaining !!!

  • @antonjatula8421
    @antonjatula8421 Рік тому +1

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

    • @dhij
      @dhij  Рік тому

      Appreciate it!!

  • @apidas
    @apidas Рік тому +2

    great video. appreciate the sharing

    • @dhij
      @dhij  Рік тому

      Appreciate it!

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