Golang Generics. Do we ACTUALLY need them!?

Поділитися
Вставка
  • Опубліковано 22 сер 2024
  • Golang Generics. Do we ACTUALLY need them!?
    In today's Golang video, we will talk about the implementation of Generics in the Go programming language. We will go through the reasons why we need Generics or why we don't need it in Golang, along with some points that we need to know as a Go/Golang developer from the generics implementation proposal. Enjoy!
    --
    Golang Dojo is all about becoming Golang Ninjas together. You can expect all kinds of Golang tutorials, news, tips & tricks, and my daily struggles as a Golang developer. Make sure to subscribe if you look forward to such content!
    Get Your Golang Cheat Sheet! - golangdojo.com...
    Git repos & notes - golangdojo.com...
    Golang Explained - • Golang Rune - Fully Un...
    --
    #golang #goprogramming #golangdojo
  • Наука та технологія

КОМЕНТАРІ • 64

  • @GolangDojo
    @GolangDojo  3 роки тому +5

    📝Get your *FREE Golang Cheat Sheet* -
    golangdojo.com/cheatsheet

    • @codeaperture
      @codeaperture 3 роки тому

      I used my email njugiastudio@gmail.com but didn't get the cheatsheet. All it says is account created

    • @GolangDojo
      @GolangDojo  3 роки тому

      It’s coming soon in the next few weeks

  • @MultiKaloudis
    @MultiKaloudis 2 роки тому +19

    Personally I would love if they used instead of [T any] 😀

    • @petermuller608
      @petermuller608 2 роки тому +4

      Would conflict with operator less

    • @allanguwatudde7623
      @allanguwatudde7623 2 роки тому +2

      Try typescript

    • @muzafferckay2609
      @muzafferckay2609 2 роки тому +2

      That is not a big deal as far as the feature works well.

    • @user-ds1pu2vc8s
      @user-ds1pu2vc8s 2 роки тому +6

      but the latter also would conflict with index operator, that's not appropriate counter argument

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

      The reason is cause the EBNF discrete grammar

  • @shaileshb8417
    @shaileshb8417 3 роки тому +10

    finally found a good video explaining about generics.
    Awesome video buddy

    • @GolangDojo
      @GolangDojo  3 роки тому

      Thank you! More on the way

  • @burnere633
    @burnere633 3 роки тому +19

    You're an up and coming UA-camr and I'm trying to learn Go. I thought we might hit it off, until 1:24 happened. You crossed a line there.

    • @squ34ky
      @squ34ky 3 роки тому +7

      I don't get it. What happened at 1:24? Edit: nvm, just noticed that..

    • @GolangDojo
      @GolangDojo  3 роки тому +5

      :P

  • @jerweiyeoh7096
    @jerweiyeoh7096 2 роки тому +2

    Great explanation! Apprecaite it
    3:33 8.43M subs.
    Soon man, soon

  • @AlbertEspinRodriguez
    @AlbertEspinRodriguez 3 роки тому +3

    Awesome video editing also great content !!

  • @anvi4085viz
    @anvi4085viz 2 роки тому +1

    Young Man you are fire, good Clarification

  • @iAM80tv
    @iAM80tv 3 роки тому +4

    you are such a fantastic teacher . do you have a golang course ?

  • @rejathchandran3289
    @rejathchandran3289 3 роки тому +2

    Your videos are amazing 🔥

  • @baw7198
    @baw7198 3 роки тому +2

    Awesome like always!

  • @rahiyansafin449
    @rahiyansafin449 3 роки тому +2

    when will it come!!!!!!!!!!!????
    and please make a series of Web Development in GO!

    • @GolangDojo
      @GolangDojo  3 роки тому

      Haha, it's right after the upcoming Concurrency series

    • @rahiyansafin449
      @rahiyansafin449 3 роки тому

      @@GolangDojo which framework / library you're gonna be using in web?

  • @ralvescosta
    @ralvescosta 3 роки тому +4

    1:24 kkkkk.. crazy!

  • @yo_mono
    @yo_mono 3 роки тому +4

    Is your current job about Go programming? Or are you still professionally programing in Java? If the answer is the first one, I would love to hear about your job

    • @GolangDojo
      @GolangDojo  3 роки тому +13

      I guess you wouldn't want to hear about it then lol

    • @OhhhThatVarun
      @OhhhThatVarun 3 роки тому +1

      @@GolangDojo 🤣🤣🤣

  • @mgmyo7066
    @mgmyo7066 3 роки тому +3

    why i can't use generic in go version 1.16.6, it show syntax error: unexpected [, expecting (

    • @GolangDojo
      @GolangDojo  3 роки тому +1

      On golang.org -- "To set expectations, if everybody is completely happy with the design draft and it does not require any further adjustments, the earliest that generics could be added to Go would be the Go 1.17 release, scheduled for August 2021."

  • @michaelfulton1080
    @michaelfulton1080 2 роки тому +1

    Can’t wait

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

    I'm watching this after go 1.18, 😅

  • @RUVIRECORDS
    @RUVIRECORDS 2 роки тому

    I love your videos. Kudos to you brother

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

    Thanks a bunch, helped a lot!🙂 Just a question: On what version of the go compiler will this piece of code still work?
    type Type interface {
    type int, string
    }
    On version go1.19.2 linux/amd64 , I am getting the following error:
    , identifier or '}' expected, got 'type'

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

    I am actually with go, generics makes your code unreliable and convoluted , I rarely use generics unless it makes sense. but i do like it to be a feature, because you do rarely need it.

  • @letsgetrusty
    @letsgetrusty 3 роки тому +2

    1:25 You're wrong for that one

    • @fukmyass
      @fukmyass 2 роки тому

      😭😭😭😂

  • @eboatwright_
    @eboatwright_ 3 роки тому +1

    Yes.

  • @EdwinDalorzo
    @EdwinDalorzo 2 роки тому

    Thanks for sharing. I enjoyed the video, particularly your explanation of the the problems of not having generics and the alternatives. I'm very new. to go, but I understand another alternative is code generation, which is still duplicating code but without having to do it manually. Perhaps you could talk about that in the future. It is curious because I believe Go is probably the only major statically-typed programming language without Generics. In an comparison in the reverse direction, it is also curious how it is until recently that many programming languages have started to incorporate the same concurrency features that Go has had for a long time (e.g. Java's Project Loom).

    • @GolangDojo
      @GolangDojo  2 роки тому +1

      On top of that, generics is coming to 2 months!

  • @robimalco
    @robimalco 3 роки тому +1

    great video thanks for this

  • @RaminChopurov
    @RaminChopurov 2 роки тому

    Good explanation. Thank you.

  • @peanutbuttermochi9499
    @peanutbuttermochi9499 3 роки тому +1

    i work with Go everyday and ill take anything to make it easier to stop having to write switch(typeof whatever) case type1 case type2 etc etc....

    • @GolangDojo
      @GolangDojo  3 роки тому +1

      Hahahaha

    • @axea4554
      @axea4554 3 роки тому

      Idk, I write go for 1.5 years and I have probably not used type switch once. I guess I usually write a concrete code lol

    • @peanutbuttermochi9499
      @peanutbuttermochi9499 3 роки тому +1

      @@axea4554 I write a lot of dev tooling, so i have to make my code incredibly general purpose.. so yeah reflection and type switches come around here and there haha

  • @JasonJA88
    @JasonJA88 3 роки тому +2

    Love it.

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

    Check the trash of 1:25 second. There was rustlang

  • @petermuller608
    @petermuller608 2 роки тому

    Golang of cause always contained generics, they are just too useful (as you said in map and arrays)
    Just user defined genetics were delayed quite a bit

  • @kishor2754
    @kishor2754 3 роки тому +3

    1:25 lmao 😂

  • @Dino-qz9bt
    @Dino-qz9bt 3 роки тому +1

    Isn't there type "any" in Go?

    • @GolangDojo
      @GolangDojo  3 роки тому

      We don't know yet. We shall see soon!

  • @codeaperture
    @codeaperture 3 роки тому +1

    Can I apply this concept in Typescript generics

    • @GolangDojo
      @GolangDojo  3 роки тому

      Don't know much about Typescript unfortunately!

  • @AkashRaj-wd6wm
    @AkashRaj-wd6wm 7 місяців тому

    RUST in DUSTbin ????

  • @PabloTriandafilide
    @PabloTriandafilide 3 роки тому +2

    1:25 Rust!! 😂😂😂

  • @jxsl13
    @jxsl13 2 роки тому

    This is Ferris animal abuse 1:23