Go Class: 10 Slices in Detail

  Рет қаралды 13,375

Matt KØDVB

Matt KØDVB

Күн бұрын

Пікірлер: 29
@makkurotatsu
@makkurotatsu 3 жыл бұрын
After getting bitten by the subslice-from-slice capacity issue (which felt like a throwback into the 1980s and programming in "C"), I searched for information and came across your Go Class YT series. My compliments for how clear and concise you present the subject matter.
@mattkdvb5154
@mattkdvb5154 3 жыл бұрын
Thanks! Yeah, it would have been better for the two-index slice to fix capacity=length. Sigh.
@unionafrican6094
@unionafrican6094 2 жыл бұрын
You know what? Since 25 minutes I'm trying to write something to explain what have you done for me but I couldn't. Sir, You're the only one clarify the slice to me.
@bernhardbaumgartner4702
@bernhardbaumgartner4702 Жыл бұрын
Your KZbin serious is better than many paid courses on other platforms like Udemy or Coursera and stuff. Man, you really have a gift there, especially when it comes to explaining rather complicated issues like the slices/subslices thingy! So far I wasn’t even aware of it. Thanks buddy, highly, highly appreciated!
@srenh-p3798
@srenh-p3798 Жыл бұрын
To anyone, like me, confused by the fmt.Printf() statement at 1:00, which is seemingly missing a parameter. "%#[3]v" is referring to the third parameter following the format string. Which in this case is the slice 's'
@Taddy_Mason
@Taddy_Mason 9 ай бұрын
Thanks for explaining that, it was bugging me.
@AmirSerati-c5n
@AmirSerati-c5n 11 ай бұрын
This video is a must for anyone learning go and generally computer science
@kewtomrao
@kewtomrao Жыл бұрын
So slices are just pointers + manipulation uisng slice descriptors and abstraction on top of it. The way you showed the slice descriptors makes it very easy to comprehend. Thanks for this amazing tutorial
@LesterFernandezIO
@LesterFernandezIO Жыл бұрын
I love the technical depth. Awesome video.
@eldarkurm
@eldarkurm 2 жыл бұрын
gold mine of knowledge
@massimo6767
@massimo6767 Жыл бұрын
The subslice thing is counterintuitive but it makes sense: b points to a and c points to b which points to a, so the slice operator [n:m] always refers to the same underlying head cell of the array.
@plutack
@plutack Ай бұрын
wouldn't it have been better to be a copy instead of a reference. i get that is how slices are designed cos go does creates a underlying array so a ponter/referenve does makes sense.. i think this ultimately promotes the use of slices rather than arrays for anything
@MixturaLife
@MixturaLife 6 күн бұрын
Was doing advent of code this year, decided to use go to learn it deeper and faced this very strange behaviour So basically never append to or modify values in slices that were derived from array/another slice…😅 Thank you for explanation!
@fraidoonhu9284
@fraidoonhu9284 2 жыл бұрын
Oh wow that's how should a teacher teach!
@skl9942
@skl9942 Жыл бұрын
You are a master at explaining, why isnt this a frontendmasters course already? However the whole copying a slice part feels weird to me, no matter how you do it. I wonder why they didnt just let slicing a slice would create its own slice and copy the values so it get an unique address and capacity out of the box. Even adding capacity feels strange when you still point to the same address until you append to it
@ericwinchell
@ericwinchell 2 жыл бұрын
24:50 wow and yikes
@secondwavesoftware3607
@secondwavesoftware3607 Жыл бұрын
Beautiful
@mohammadrezadavoodi3561
@mohammadrezadavoodi3561 Жыл бұрын
Facinating
@Max-bf9lm
@Max-bf9lm 5 ай бұрын
Mind=blown
@JoeEnos
@JoeEnos 2 жыл бұрын
I’m following this and I can see technically why it does what it does - but the end result is nuts. Sometimes an action will modify the underlying array and sometimes it won’t… JavaScript arrays, and C# arrays and Lists just seem much less susceptible to these kinds of things. But I suppose that comes at the expense of performance and unnecessary allocation.
@oleksandrhumeniuk9724
@oleksandrhumeniuk9724 7 ай бұрын
This lecture must be called "Why you should never use go". 😁
@Lakmalniranga
@Lakmalniranga Жыл бұрын
Another million dollar bug 😅
@sravant
@sravant 2 жыл бұрын
After seeing this i'm scared to use slice without capacity syntax. :)
@hamzamasood703
@hamzamasood703 Жыл бұрын
Even if you use the capacity syntax, if you an element of an index in slice c that also exists in slice a, then slice a will also get changed. Regardless of the capacity. YIKES
@seandougherty3022
@seandougherty3022 3 ай бұрын
@@hamzamasood703 well yeah, it's a reference. that's how that works :)
@joeljose6608
@joeljose6608 2 ай бұрын
Array is immutable by nature , But can be mutated using a slice🥲. This concept kills me.
@plutack
@plutack Ай бұрын
what i understand from this, someone should validate. If you are ever going to have any reason to slice an array.. you are better of creating a slice from the beginning and let go handle the underlying array.
@MrVipulLal
@MrVipulLal 2 ай бұрын
Sorry, but I think C or even c++ is way easier to understand and use
Go Class: 11 Homework #2
22:59
Matt KØDVB
Рет қаралды 7 М.
Go Class: 25 Context
36:24
Matt KØDVB
Рет қаралды 25 М.
小丑女COCO的审判。#天使 #小丑 #超人不会飞
00:53
超人不会飞
Рет қаралды 9 МЛН
Creative Justice at the Checkout: Bananas and Eggs Showdown #shorts
00:18
Fabiosa Best Lifehacks
Рет қаралды 35 МЛН
[BEFORE vs AFTER] Incredibox Sprunki - Freaky Song
00:15
Horror Skunx 2
Рет қаралды 20 МЛН
GoLang Slice в деталях, простым языком
32:09
Николай Тузов — Golang
Рет қаралды 91 М.
Go Pointers: When & How To Use Them Efficiently
14:09
Anthony GG
Рет қаралды 87 М.
This is your last video about Golang Structs!
15:57
Flo Woelki
Рет қаралды 10 М.
Go Class: 26 Channels in Detail
25:30
Matt KØDVB
Рет қаралды 14 М.
Go Class: 12 Structs, Struct tags & JSON
42:23
Matt KØDVB
Рет қаралды 14 М.
Go Class: 05 Arrays, Slices, and Maps
48:13
Matt KØDVB
Рет қаралды 23 М.
If you are a beginner in Go, avoid this Slice pitfall!
9:26
Flo Woelki
Рет қаралды 5 М.
How To Stream Large Files Over TCP In Golang
17:50
Anthony GG
Рет қаралды 37 М.
小丑女COCO的审判。#天使 #小丑 #超人不会飞
00:53
超人不会飞
Рет қаралды 9 МЛН