32 Reasons WHY TS IS BETTER Than Go

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
all right by the way for those that don't know for those that haven't been a part of it for those that live under a stupid rock this right here is the milk okay the milk baby the milk daddy milk me Daddy known by several names a mustache that is both beautiful yet shows a softer side of Milky um dang dang uh followup if you don't know anything about Melky mky you stream you have YouTube videos you actually make really good content I think we've reacted to one of your videos and you've been on the stream once you made some thank good content I am guilty of watching your content offline I I actually just watch your content I watch almost no engineering content like zero and you might be the only person I I watch offline that's an honor thank you like that's it definitely not armor cell no that's a private one that's a private definitely don't watch no never watched it probably not going to watch it that twitch algo not going to happen by the way great work on the twitch algorithm I just love the amount of anime and Bobs and vtubers I get really really just reminds me who the people are that watch My Stream and that they're all the generates it's just it's just you know daily I'm the ml guy so I I'm respons for that algo so you're welcome everyone you're welcome giving you the content that I know you really want all right anyway so here we go so we found this post you actually found this post and you linked it to me and says anyone who tried to like goang and tried it many many times but still don't like it compared to typescript question mark and this is about to be a pretty big thesis as you can see 32 individual points I would have went with 34 and called it rule 34 of goang they didn't do it though you know I I can understand they're not very good at the internet so the hyp catch on you g interrupt me like that sorry sorry so I'm excited okay it's only second time I'm excited to read the pamplet okay just remember we had the whole timing and all the jokes pre-planned and now they're all ruined every last one of them uh give the hyper around goang and too many medium posts uh highlighting so many node python companies are migrating from node python to go and got a 4X and a 5x and all the wonderful things described about it I've been exploring goang since a few years now and even though I know all about it I just don't like the language itself and I'm really really surprised that people say go as a language is better than typescript syntax typ system Etc wise to me I feel the exact opposite typescript has super Advanced type system with super Advanced to which go does not even stand there are many things I never liked in go as a warning long list below okay so before we even address it Melky I would love to hear a couple things you do not like about go a couple things I don't like about go okay but so first of all this person the types of community I love them I love how he says uh you know although there was a 4 X 5x performance go still sucks and it's like I know everything about go and I I just found that opening statement I knew I was going to be in for a treat for this um I agree with all these things I definitely when it says I know all about it that's I mean it's pretty tough to know everything he but he knows everything Prime he knows everything for me the few things I think go lacks obviously and this article goes through them uh no enums like that's you can't argue that no enums I you know that one is uh I stinky one um but can we can we just tea out for just one quick second there one quick second granted he is comparing go to typescript it typescript is not known for amazing enums don't add logic into this article okay you're right don't do this right now typescript has moderately better enum support super Advanced type system okay you don't know about the type system but the one gotcha that I actually agree with this article and it's actually the first point there is the nil pointers and there's no checking of nil pointers and go that one I've been caught by it um and yeah I I I agree I agree my hands are down uh everything vertical is horizontal I agree okay okay I I think I can actually join you on this one I I'm really hoping that with the generic introduction and all that we can start seeing an option type be put into to go cuz I think that would effectively remove all Need for nil you wouldn't have nil anymore you just always have an option type and so I'm hoping that that can somehow exist my my guess is that it still maybe can't we might need a bit more but something like a maybe would be fantastic and I'd absolutely love to see that yeah that would I don't want to get caught with this and there's been times where I've like in didn't instantiate you know a map or something and then try to call a method on it everything looked great and gravy on my side and then once it's deployed it's like wait come on go on what are you calling this method on this doesn't exist you idiot I'm like touche touche Z yeah zero so I I completely agree on that Maps being nillable I feel like is a very confusing just like initial topic because then my brain's Thinking Inside like I I have to then ask the question when I pass a map do I copy it like everything else you always pass by reference unless if it's this choice though of interface SL arraymap just feels very arbitrary for me and so I do agree with this whole n problem which is really just more of a problem with pointers in general is that you just have to think about it too much and thus happens it does all the time all right all right so let's go to number two now I I feel like this is a very interesting one which is air handling or lack thereof at every line is insanely painful to see and if you forget to check any error then the code could blow up and the compiler will not stop you at all so give me some thoughts on this one okay please I I I was going to wait till you you if you want to go this but this one this is like the classic why ghost sucks argument the error handling this this anytime you go to like a a super rust Dev or a typescript or a front end you know whoever they're like well goh sucks because of the air handing because it doesn't exist my whole philosophy on this is first of all this statement is not true there is error handling hold before you go before you go I I just want to do one quick thing sorry I'm sorry to cut you off right at right as you're climaxing there I was so climaxed oh my God a B I have to take a cold shower now you better you better on there we go I'm going to put bad good okay MH so I'm going to give people three options quickly start going okay Melky start saying your opinion so that it will affect this poll go okay by yeah so air handling Ino exists I think the main problem people see is twofold one is that it's up to the programmer the engineer to actually you know handle the error value which sometimes you can call a function you can ignore the error value and I think that's the main point that people complain about well I can just underscore and I can forget about it and hence there's no error handling but I think that's kind of like a n like Ave point because the error the value exists it's you are making the conscious decision to not handle that error it's not that goal is not providing you the ability to handle the error is you are making the decision the engineer the architect the Maestro of your code to make that decision I think that's the argument that people don't really absorb into their uh you know their sponge follicles and when I write go I like handling my errors the way I want to do I want to panic maybe do I want to log it yeah absolutely it's up to me I like that control I like that granularity of you know doing what I want the error and then the subset of that argument is the if error equals nil and people like well I have to always repeat it I have to repeat it and the argument there is like I I can see that it's annoying but in go errors are values the way the same way you're G to you know handle any sort of constant any sort of Declaration whatever that's the way errors are and hey I'm looking at you everyone writes code with lots of Errors so you're going to be handling lots of if error does not equal n all right so suck it up it's beautiful it's great and uh handle your errors properly because it's really good for a good engineer so okay so I'm I'm actually on your team for most of this yes and I thing that I think yes I think the thing that's really missing from his argument is if I jump over here into node for a quick second and I like this json.parse open squirly brace single quote and I'm going to parse that that airs nothing in it says that that's going to air you don't know it's going to air it throws an error and changes your control flow completely whereas if you do the same thing and go do a little bit of unmarshalling marshalling whatever the hell it's called I always forget which directions which I have to read the description it uh it has an erir as a part of the whole situation so that you know did this thing just not like was I able to even be able to read this thing or not whereas with typescript you don't get any error handling you get error catching which is like the opposite of error handling right it is just like I hope I have a try catch in a place that makes sense for whatever I'm doing right because it just might not yeah exactly exactly and that's the that's the argument I see especially from a typescript form like a subreddit that's it's like you can have the same behavior the same like level of negligence if you will in types with the with not having proper Tri catches right it's it's like the same sort of underlying root Behavior if if if this person is saying the lack of error handling or lack of you know airor control whatever you want to put like it still exists in typescript you know what I mean it still exists it's up to you to design your system with try catches or handling the error values like if you are a negl negligent engineer you're going to be negligently handling your errors and I think that to me is like the the tldr and I like error handling I it's like I think it's one of the Core Concepts and core uh protoc is needed for a good engineer it's like how do you handle these how do you make sure your code your application runs smoothly gracefully does it Panic do you want it to that's all like error handling and that's like the branch of thinking that I think people are yeah you know they don't jump in so I'm gonna I know we probably beat this thing to death but I do want to do one last thing which is let's just take something like uh let's let's take this this line right here right I have this beautiful little piece of template code right here that's going to create a new template it's going to throw a nice little Funk map on it and then it's going to going to you know hit it with the parse glob and that thing is going to return my templates if I get it or an error now I get to do this nice little line right here and if I don't have an error I get to keep on going and I have this now if we were to do the equivalent in typescript I'd actually have to do something that looks more like this let temples uh you know is uh actually going to be an undefined or you know the type and it equals undefined then I'm going to have to try then I'm I'm going to have to catch the air and then I'm going to have to do all this kind of stuff and I'm going to have to put this in here and you know it's going to look something more like this as opposed to the by having the air as a value I don't have to do this like dance where I have to actually put the value outside the tri catch because it's its own block and its own scope and then I can Define it there and then I have to like I I find this to be just the world's most annoying version of handling stuff right like this is super this is like a thousand times more annoying than this and I I got a nice little remap for that so I can just whoopsies I can just hit him with the leader e and boom yep or equals no return it what was that what was that you want another one you want another one you want another one another one another one I dude I can give it to you all day baby girl like I know these things and so for me it's just like that is so much less annoying than whatever the alternative they're suggesting is which is to get TR catched on right yeah and I honestly think the TR catch actually presents more opportunities to not handle the error because you know when you call this templates function if you read a docs you're going to return you know probably uh an interface and then an actual error value by the function contract definition you don't have that in JavaScript or typescript you are you actually have to create the try catch yourself but if you read the documentation of the functions you're writing from a library it's going to return an error so you know you can handle that so I actually think it gives you more opportunities to write a proper system yeah yeah uh Judo says Global error handling isn't all errors are unique so this is probably where my one thing I will say about uh TR catch that is nice is that if you have uh if you want to go like the lazy programming route and you just have that if there is any error I'm just going to respond with my server with a 500 try catch actually makes that very very simple and so I can totally see why you'd like that same with the CLI tool I just want a CLI tool that the moment I encounter an error I'm going to pretty print out the air and then exit with a one that's totally doable in node very very easy you just do a process on uncaught exceptions or uncaught or unhandled rejections or whatever it is not I'm not talking about like an arch user in dates but I'm talking about like exceptions and and rejections here and so like that is very useful I will say that that is very very useful to have and it's nice for a very narrow band of items but for the most part that's not that's not my experience you know yeah I was gonna say like yeah I I actually completely agree with you uh but the one thing I and we had a discussion yesterday when uh we were talking online uh it's like I haven't faced that situation where something like that makes more sense in terms of handling that you know blanket error handling if you will yeah uh similar to how like I I I was talking about Zod and like I just never faed that particular thing which maybe we can get into in a future time but yeah I I agree with that but I personally haven't seen a situation myself I'm like I'm just G to globally handle all my errors yeah yeah I actually want to make a Zod competitor I have a very good idea in my brain I'm very excited about it and I'm going to do it what's the name give me the name it all matters about the name if the name's not I don't have a good name truly I don't have a good name but my idea was either to take protuff definitions or typescript definitions either or and generate validation functions that are all inlined and use a DOT separator to look up everything because then you get much better performance and it doesn't have to do these manual crawls and Zod is just really really slow and so you define your types and then that generates validation as opposed to generating validation and then creating your types from it that sounds awesome and I think the Proto I'm actually excited G do yeah yeah that's I think that'd be a dynamite thing and then you just get that right out uh anyways just a thought I've been having had it in the shower yesterday not a big deal uh anyways uh number three no Union or some types is also a big problem I mean they exist it's just super messy the union typing and go is is it's very they typing I didn't even realize they had do they is it just like some version of the sea yeah it's it's not like it's not built in there's nothing that you can actually Union you have to kind of hack your way through it okay it's it's not pretty it's doable but not built into the language so in a sense number three is kind of a valid point there is a way to get around it but it's I it's not very intuitive all right so for those that don't know what a union type or why those things are good specifically in strict typed languages or strong typing whatever you want to call it whenever you have a list of more than one type that simply can't be represented or shouldn't be represented as an interface a some type is very very nice you can say hey this thing is a string or it's a number or it's this object right so you can think of uh whenever you do merge deep merge deep really its argument is a union type it's like it's every type one you have to kind of figure out how you want to handle each typing situation so it can be very very nice to have a nice Union type for those kind of things but what they're not mentioning in this whole little this little rant we got going on here is that typescript also handles you I know I've showed people this they handle their crap very bad crappy Union right equals string or number okay there we go we got ourselves that's a union type right so that means if I have a const a which is going to be a string array I can take that and I can create a function called uh add to uh crappy Union and this thing takes in a crappy Union and we're going to add something to it okay and I'm going to take a and I'm going to push in one well which is bad 69 nice try co-pilot and that means I can add to crappy Union a because a in their book is actually a part of it but it ain't part of it it ain't part of crappy Union this is bad why would you allow this to happen right and so this is just a crappy Union and so typescript though having some types has the worst version of some types which is a non-type enforcement some type so it's like you can do that and that's totally type safe but I would argue this is completely unyp safe and crazy now every single time I show this people are always like You' never do that yes you will do that when you have a list of more than one object you can totally have this happen and then now will fall into every single uh thing every single array that is some sub verion of it can fall into crappy Union and be used there right so it's like it's I just I don't think they have I don't think typescript has good some types either I think they have terrible some types it doesn't save you at all yep I I I hated that example so much because it's like that just completely throws off like strict typing if you can have that like that just irks me it does I get a little irked myself all right number four poor oop implementation using receiver functions instead of just having proper o op if that's what they wanted to enable in the first place which is not like they didn't want to enable op in the first place this when I got to point 4 I think this is when things start to click I'm like I think this is just like a rant like this is straight up like this person is just like trying to find as many things to to say about go that aren't even true like poor oish implementation like go doesn't have oop implementation that's not how go wanted to be built it didn't want to do that um hence it has interfaces hence it has other ways of inheritance and or not inheritance but they have property inheritance but that's it property inher yeah thank you property inheritance um th like I couldn't find my way to really agree with this point this is one of those points that I think is like just completely invalid because it doesn't make sense go wasn't built this way go wasn't designed this way and go is not used this way at all yeah yeah and and the thing is is that I love classes when I say class I mean a struct with methods hanging off of it I think that's beauti I don't want inheritance i' I every year I try it a couple times a year and I hope that I I do it right and every single time I've used inheritance in the last couple years I've regretted using it like almost every single time and so uh I mean there are some situations that people say is really nice like uh HTML element for web components you have to inherit from and then create a class from so you can have your own components was that the best way to do things maybe that was the best way to do things I can't say it was the best way or not but nonetheless that just happens and so I don't really care for o that much I like interfaces you can do most o patterns the strategy pattern is just interfaces plus concrete classes right so you can totally do that so it does have an O op design pattern in go without all that you know I it's just this seems like a really weird one to say it doesn't have my version of what I want and by the way classes and pointer receivers are identical other than how they're typed like to say that they're somehow you know that these are these are somehow different it's just a struct with a method hanging off of it like I don't know where going with this one sounds a little it sounds a little funny yeah and I think the the whole aspect of inheritance and like the discuss inheritance versus composition like go the goal wants to be simple go wants to be very very easy to use and I in my opinion when I kind of see that like I think of like not too tight tightly coupled code and so if there's a change anywhere in in the class well I think what go wants to do is like you don't we don't want you to go and change all of that you know definition those methods and go through your code like just slap the interface on it change that and then that's good that's your layer that that you really need to change everything else you can kind of leave the same way your client you can leave it you doesn't need inheritance like for me actually I see this point as like an actual Plus for go if I'm being honest like I actually think like hey yeah that's great it doesn't have oop it doesn't have all the struggles with that you just have composition and and you're happy you're laughing you're good all right next one implicit interface implementation means you have to read the entire Declaration of the file to uh just to know which interface is implemented instead of just allowing X implements Y and Z like every other language uh I got I'm I'm going to take the lead on this one uh so first off not every language works that way so every other language is actually just fundamentally an untrue statement uh but I will say that I think rusts is probably the best version of this and I do agree with his overall point which is there's not an explicit point in the code that says my struct implements this behavior and then you have to implement the following function they can go in any order you're going to have to find them like I agree a little messy not kind of the way I like to do it rust does instead if you want to implement say the into trait which is you know like a golang interface you have to say imple into for class name and so then you then in that little block you implement that interface's requirement and so for me that that feels good right that feels right which also means that if you have conflicting I think if you have conflicting names if you have conf in names it chooses the first trait that's implemented if I'm not mistaken which is also strange uh but nonetheless I just like that version better it just feels more correct than any other one uh but I think typescript having to say it implements it at the tippity top is not fun I find that to be super annoying and plus you also don't have to do this in typescript like at all yeah I I I agree it is M especially if you're if you're first coming on to go and you see an interface and then you see like a struck that has maybe not all the methods or like it's not a onetoone map you it can get confusing and I I I've been caught by that you know instancing clients and you know either missing a method or or whatever I can see the point that it's like not convenient and it's not explicit and I think that makes it a little Annoying uh but I think this is like a I'm GNA admit this may be a bias wave for me to say this but um once you get used to it I think it's fairly easy but I think that's a very bad argument I'm not I will admit like that's not a strong argument on my on my side I've been using go I think I'm just adapted to the methods and kind of that so it's also very easy though at the same time by the way look I just did the exact I I literally did the exact thing that he said sucks right now in typescript I have a class called Fu with bar I have an interface named bar I have a function that takes in a bar I hand it a foo Fu never implemented bar yeah Checkmate atheist checkmate I'm just saying it's not even required in typescript like most people don't even do that in typescript right all right six zero default values do not play well with Json serialization and deserialization and are a source of many many bugs workaround is to convert a field to a pointer and then to do a nil check but this means you have to convert all the struct keys to pointers as you can receive an entire empty struct so how will you identify what was set and what was not set without all structs being set to pointer and doing nil checks it just never ends I would just follow up with it's no different in typescript you have to do a question mark instead of a star right okay so I was actually are you confused about this one too I was I I'm actually happy you said that because I was a little confused I was like okay maybe this is a valid point because when you do like unmarshal something you don't have that guarantee that all the fields in your struct are GNA be populated right so you will have these like nil pointers potential these n nil values right and I was thinking like okay I could see this potentially being valid but then but then I forgot that this is like a typescript versus go article and so I went back and I'm like well how would I do some typescript and it's kind of the exact same thing you have to have a layer of checking if that property exists you have the exact same thing not only that but that's the whole reason Zod exists remember you just said earlier about Zod Zod checks to make sure the struct that you got out of JavaScript is the thing you wanted yeah so I was like I was okay good good but now I was like wait a minute what does typescript do again yeah Russ has the same problem they they just force you to use options so you have to have an option this thing right all right number seven cannot access keys of a struct dynamically using a variable which is so easy in typescript also very securely as well due to powerful type system okay that second point is completely invalid and in go one has to convert the struct to a map or use reflect boiler plate code just to access keys of a struct using a variable there are a small set of problems where I can understand this is useful very very small kind of set of problems like uh how about this one here's a good example of it uh you have yourself a CSV you wish to parse and it has say 10 Fields so you pass in the 10 Fields you want to be parsed and you have five different object types which could uh which may include some set of those fields you would need effectively a dynamic way to be able to look up those fields and get out those values mhm so that is like there you go there's an there to me is a valid argument for why I like this Behavior wait so but I actually I actually think I don't un truly understand this point then because what what does he mean by uh like asking the value the struct dynamically like so so I I'll give you a quick example right here um um so let's just say we have a function that's like print out properties right and I got an object that's an any uh whoopsies and I have a filter list so now I can do something like this if let's see if a filter or const uh const prop equals uh object. propop here const uh to print equals this thing uh if if prop then to print push prop and then I can just console log prop right if we wanted to do it all on one line prop there we go or sorry to print there we go uh oopsies uh it's not that way it's uh object. keys there we go and okay okay uh as key of type of object um oh yeah right did I get that right oh my goodness why you got to be like this why you got to be like this Advanced types scrip baby team dhh we're going to get there I'm going to get it there we go okay I got it um so there you go Advanced typescript key of type of object uh you can't use keys and they don't like when you call object. Keys you actually don't get a type out that says these are fine to access you actually have to say this every time it's the very very annoying but nonetheless this is a great example I just wanted to print out certain properties you can't dynamically do that easily and go so I think that that's fair well that seems like a terrible usage of objects I'm on your team I'm just if you had a a struct if you had like I said if you had a CSV you need to produce You Knew What fields you wanted you just didn't know what objects had What fields and you just had to pipe in dynamically like you could imagine like a database streaming a bunch of events and you need to take a session that has happened and pull out the behavior of whatever right and so what he's saying is that you have to either convert you have to like do some sort of uh struct to map thing or do reflect I'm onest team I think that's a I get it but there's probably other behavior that I'm missing that could also be done well or use a map no still again that's not a good case again you could just simply have things coming back that are in the object form you may not always get the option just use a map yeah this one yeah I I would just use a map but I'm just saying you may not always get the choice to just use m i agreee there no nothing you got nothing for me that's fine let's move on milk's reading I was reading chat I know you were so intense you were so intense you completely just when you had a nil pointer exception there it was your term I served it to you and you're just like I'm sorry I was reading what c a fellow uh twitch uh staff said sounds like the author Dr everything is an object Kool-Aid and and he spelled Kool-Aid wrong so I was just focused hyperfocused on that I'm sorry I'm sorry is it because he spelled Kool-Aid with a c yes yes my goodness oh my goodness disgusting um all right uh let's see let's see cre cannot create a new struct by picking SL emitting a few keys from another struct the code is never dry and go okay so I do agree with the second point which is the code is never dry go right right here but I I I normally just think this is probably a bad idea yeah I I I mean honestly when I first read this I I actually kind of see the validation like sometimes it is a bad idea because you don't want to have like two Shucks that share like you know three out of the 10 fields of one shuck I I can understand that uh but there's also I I may see like a perspective where maybe you just want a very very Niche struct that you don't want all the other fields you don't want everything else included in you know the the struct that you had you want them separate you want to use them for a very specific distinguished feature uh and then you have to remake a new struck and instead of just picking out uh existing fields from you know a bigger struck I can kind of see that but hold on hold on how do how do they then Define it right like where they're they're putting it somewhere it's not like even if you do some sort of like exclude key or some sort of magic Ty script method that I'm sure exists you still have to say I want this struct without all these other fields so it's either you provide a white or black list trying to say which ones you do or don't want or you use the worst of them all which is you just let typescript return value inference happen and then you just get these inlined objects everywhere that has like 14 fields on them and you have to go pass that around like that that doesn't seem like a w none of this for me this doesn't make any sense this argument I love the code is not dry I get that with go kind of pisses me off I'm really hoping that uh 122 and 123 really takes a deep look at the the standard and gives all the methods that I need right I want them all contains oh I I want contains so bad I want them all everything everything yeah there is a way that you can make a cop like a you can declare a new struct from an existing struct uh but I agree you would have to kind of I'm just thinking out loud you would have to filter out all the fields you don't want or somehow have like an empty struct that then you kind of pick the fields from another struct into into the struct but it's going to be the exact same thing like the behavior is it's not a very smooth handling Behavior at all no neither handle it well yeah yeah there's gonna be problems both ways you see it all right painful Json handling especially deeply nested or dynamic Json as the Json mapping logic ins side strings string uh struck string tags where there's no autocomplete or uh and no compile err I I don't I actually don't I've read this a few times I just don't agree I don't see painful Json handling I actually think even for deeply Nest to Json like I've never had a problem using the built-in like Json library and go uh you can Define everything well you can I've just never had an experience where I was like oh man I have to use Json go right now it's been fairly easy for me to just take a payload use Arm Marshall and handle like that like I've never had I I don't understand this point to be honest I've never felt this I honestly am just too stupid to understand the point I actually don't even know what it's trying to say I think with what it means by no auto complete or compile time or or nor compile air I don't know what I honestly are they talking about like importing Jon I also don't understand that point from I don't get it at all I think when you said deeply nested I put it like when you like get a payload response from something and it's like nested it's a nested object and you kind of have to Define like on go if you want to take that payload from whatever API and put into a struck you have to create like a nested struck to handle that um that's the way I read it when it came to the autocomplete and the no compile error that I was just like I don't even I don't even know where to what to know for that one so I just kind of skipped that part yeah I guess I don't quite understand this one because oh I I see a point CH again did you what yeah yeah yeah I could tell right away he's reading chat again people I'm sorry but one point someone did say is like let's say in go you have like your Json tags that knows what to un Marshall right um if you make a typo there like I'm just reading chat because it is I can okay maybe a if there's a typo there or something that's not right so you don't get that field you wouldn't know until you explicit look at that struct after on marshaling right there's nothing that tells you hey like this field wasn't um unmarshal or you didn't take this F something like that maybe that's what he means okay okay that that's fair that's fair okay I can p I'm purchasing that one oh yeah all right uh so okay we'll give nine a little something I I I kind of get that I kind of get that yeah uh number 10 code littered with pointers non-p pointers slice capacity interface Madness everywhere I wouldn't put it as ever I mean there are some there's some pointer pointer non-p pointer doesn't bother me I don't I don't think I ever have thought about it and go just ever slice I still don't even know what that means at this point capacity I'm not sure I've never passed a capacity around so I I I don't know what a capacity is I I don't have the capacity to understand this okay zero zero I'm not passing my capacity at all man you keep that capacity private Fred it's a n pointer right now it's just a n pointer uh interface I get this one it is kind of annoying to see I mean again this just goes back to the sum types thing if you could have a sum type you wouldn't need to have interface and anymore I get it fine uh it's not really everywhere it's just some places okay whatever no function overloading I don't think this is a problem I don't think there's function overloading in typescript either there's not function overloading in JavaScript I don't even know what function overloading is if I'm being honest like function overloading so that's like a a remnant of java I think you can do it in C++ as as well maybe uh I I actually can't even remember where effectively you have a class that takes in a function Fu and you can Define Fu multiple times depending on the argument type so long as the signatures are unique you can have the same function defined multiple times oh Elixir has it but they have pattern match uh overloading which is actually super cool right so you can just say like if a empty array is passed in here execute this one uh but again no function overloading I don't think this is necessarily a problem what would be the UK case of using function overload like in any language why I think Elixir is very much more clear I think Elixir makes sense uh so a good a good version of this is in Java okay I'm going Java on this one let's say that you have something called like in Java of course you have classes for everything called like I don't know quicksort right quick swort and inside there you have your public uh public void sort and it takes in in interray okay and so this is what you want but but privately you need to keep track of a bunch of information so you're going to have something that's like a private void sort that has this right that actually has your high and your low and all that extra information that you're going to want and so that way you have your public one that behaves one certain way and your private one that actually is the one that you'd call so you'd actually call sort. this right so that's that's what I know of as a reason why You' do that but I don't I don't know of any other reason why uh the other one people are saying people are saying function overloading for uh what's it called for ad right so if you had ad or Max or any of those ones but you could also just use I know Java disgusting Dan's game hard Java Java Java Scarlet Johansson or schola Johansson uh but this one right here you can also just take that and use generics to solve that problem like I don't think that's a problem because generic solves it and so it's not a real thing all right no Turner operator I mean I agree like I've used a Turner operator in Javas I think it's in types in JavaScript I love I like it uh but I don't know like in go I I don't know I treat JavaScript and go very differently no Turner operator it it I guess I as far as I know there's no turn operator in go or like explicit one that I'm aware of but I've never been caught by this like and if expression so you can't return it from an if else which is like what does yeah so I don't know like the turn oper is nice when you have to use it but like I don't say it's a necessity for a language you know what I mean I don't think it's really a a if you don't have it in a language it's good it's it loses the value language itself yeah so I don't know to me it's not a huge one I I find it more annoying when I I mean because I try not to use turn Aries just in general just because I I always once I start using one all of a sudden it gets a little Rowdy sometimes and I'm just like I've made a mistake you know Hal uh and so I just try not to use them in general but I I understand this point a little bit like rust has uh they don't have turn ay statements but they do have like uh let Fu equals if I don't know bar uh then you could do like five else else six right so that would work in Rust that's perfectly fine and rust and I'm okay with that I think that that would be nice to have and go but if statements aren't they're if statements they're not if expressions and so you can't the way I look at Turner operat it's very like I guess my my experience with Turner operators comes from two two methods react I use turn operators a lot in react like Rend I think that's actually an anti pattern is is is that but keep on going yeah I think I think TJ said something like that like that in chat too but then there's another one for like actual types for like cdk code like deploying stuff and it's like depending let's say you have to deploy something to AWS and there's two different ways like you can on your beta environment or prod environment I use Turner operators that way so like if the environment is prod this is going to be like the address of a Lambda function for let's say or else it's the beta one and then you can you know you don't have to have two sets of of code but at at the end of the day it is almost like syntact sugar because it's just an if statement you can just have an if statement that that handles that as well so I don't know the feature is nice but at the end of the day it's not like you don't have the capability of doing the exact same thing in any other language get that out of there get that out of there nobody knows it happened no no no a ain't nobody knows what's going on there uh Hey Prime hey hey bisco you calm down yeah I would love to have some types I think some types would be nice but at the same time I always go back to the same thing which is Go's Simplicity might actually be worth it you know what I mean maybe the fact that there isn't some types and it just forces you to do something everyone just does it the same way and maybe that's okay I love some types though so I'm I have a hard time agreeing with that statement because I always get to the point of just having a list with multiple items in it and I don't want to use interface but I get it uh all right anyways uh no enums cool that's typescript known for its excellent enums uh no option multivalue Json Keys possible to express I don't optional would be a pointer right so you can say hey this thing can exist but it's a pointer yeah are they saying like you can't like if you had a value like right count count is the a number but count might not be there is that what they mean because can you do a pointer int and it' be nil or the number is that like a thing or am I like too deeply reading into to go on that one if you what if you have a a no pointer to an INT well yeah because you could imagine like let's just say you had a you had something you were retrieving and it could have an optional count to it right count may or may not be there so it's a number or it's not there so typescript would be question mark number right whereas would that be like a pointer number is that what you do yeah okay well an in value we don't have like numbers but an end and I think would default to when I say number I just mean in yeah yeah yeah jerk jerk a you want to be specific here okay okay 32 okay I don't need all your bites all right uh multivalue Json keys I don't know what that means and you have to resort to interface okay that's when you so this is a some type argument again and to do type casting later on which is difficult to read in jesson uh let's see is big and the code is big uh you know the thing is is that even if okay let's just pretend you don't do this if you have a some type in typescript or a Some Type in Rust you still have the identical if statement going on so that's why this is my whole like go maybe can use interface is that with interface you go you know switch type is it an INT but with rust you're like match thing it's an INT right like I mean are you really getting around the thing uh it's safer in Rust because rust has a type uh like a a compiled compiled in you handled all the possible types it's exhaustive in Rust as someone saying so I get that I'm on that team but is it much different programmatically like are you really making something less or more complex I think it's the same thing just written in different languages like I I think a lot of these like little issues exist in go in Rust in typescript it's just masqueraded by different syntax sugar or different you know language specific ways of handling that issue um but I don't think it's nothing you I know TJ is that a te meme it's a TJ it's a very low quality tej meme I I'm glad TJ TJ apparently used a photo from 1814 nobody knows what happened here the fonts are different I love how the fonts the average tour enjoyer is bigger than the average if expression enjoyer because he had to make it fit just a rookie rookie meing there I expect more from te all right we all agree with this one let's let's let's keep on going let's keep on going okay just beyond Json if you if you have to do Json validation for incoming request then you have to add more and more validation logic uh using third party libraries to Json struct tags which uh is a string uh where there is no type completion or custom functions are just a pain to write okay I mean Fair Zod is easier to use for this yeah y okay uh Fair we'll get we'll give point5 Fair on top of 15 little cowgirl on this 15 here we go I should probably never say that phrase again because there's a there's a lot of misinterpretation in there y on top of 15 if you have also support graph wheel / websocket alongside rest apis and database schemas then it's an absolute hell and code becomes absolute mess with so much logic and the jesson strings uh tags on top of that validation uh you know I actually don't mind the string thing as well so I'm kind of if or on it I mean I actually so the when I read this point and it's like the uh the Deb schemas I was like okay well I don't know like I've never like I guess I agree with you it's not that bad there the the strength thing but I I can see that it can be better I think this person uses tools that exist in like the JavaScript or typescript like ecosystem that make it easier for them and I think that's what he's saying that doesn't exist in go to to handle and that's when he's saying the code can become messy or repetitive or anything like that okay and I'd also say that if you know no matter what you do you have to spec like if you have a field that's named different you know like graph queal requires underscores and your database is in camel case and websocket sends it in camel case but the Json if it comes from here is underscore right and so you have to like put in all these things anyways whether it's in typescript in the struct or not in the struct like all the naming still exists it's just exists elsewhere so I don't really necessarily see it as a positive or bad all right no meta framework this I just I don't even care I'm not even GNA I'm not even going to address this opinion because hmx is great okay I love this point can we agree that htx is great it is and I love this point I love how he's using it because above he said you know uh it's just such a JavaScript thing to say like there's no meta framework that exists you know to me that's such a like okay like that's that's a point they're using against go like again 17 is one of these points in this article that actually strengthen the argument to use go in my opinion because there is no meta framework you don't have to learn a framework on top of go yeah you don't have to learn a first and also meta framework I just hate that term but you don't have to use a framework that uses a framework right okay I heard you like framework dogs Yo Dogs uh capitalize to export use instead of us okay yeah I can we agree I don't like that one I don't like I actually don't mind it I see the I this is I don't mind this I see the point of using something explicit that says like export function or public like I get it but like are we really going to complain about just capital M or Capital whatever like just capitalize it and then you're good and then you're happy and then that's it like out of all the things to put onist L like I don't know about that one okay copium just saying we are going to complain yes we are I hated this in the beginning yep I believe we all hate this one hold hold on Winchester hold on I think we all agree that one's awful and I think you're wrong okay so we'll go we'll go on this I think you're wrong poor generic implementation Fair uh I don't the generics aren't complete I know there last time I looked at them to be fair I only looked at them in8 and and you couldn't do poter receiver generics and so yep fair not arguing that one yep generics are generics are just really really strange in and go and it's weird they're very limited yeah yeah and I I think I understand why I think I do due to like you know because pointers and how functions are called and all that is probably very Dynamic so you add a little like a lot of dynamic dispatch on top of it plus then trying to do generics I think it kind of you know I just try to imagine what would that look like in C and I just can't imagine it so anyways uh no default function arguments no optional function arguments only vartic possible I mean I dis I don't I think it's good that you don't have optional arguments if I'm being honest like yeah I I I kind of like it I like the fact that uh you don't need to have any op you need to Define you need to be explicit and you have to pass things to to to your function you can not pass what you define the contract is very distinguished very definitive between the caller and then the receiver I like that I like that to be honest very brave of you to have such a bad opinion all right no air stack traces as errors are not thrown but returned and you'll have to accumulate and build an entire stack uh on your own and let's see um I disagree with this yeah I don't I don't think this is the same because let's just face it most people that look at a stack Trace look at the last item in a stack trace and the only times you ever want more additional information is often when you're doing something yourself now I mean there is the rare case where something happens deep inside the system and you have to go debug a third party library and stack races are really nice then but typically the third party Library returns exactly what happened anyways feels pretty easy I don't know not a thing I like how this person just earlier in point7 about the meta framework and I know they're different but said like oh like go doesn't have this meta framework external party and now they're saying oh well you need a thirdparty library tool for proper stack tracing it's like buddy you use JavaScript and typescript you're using third party libraries to create carousels and and to enlarge an image like come on I I'm I'm on this team all right let's see no try catch finally and throwing named erors is most main like okay so obviously this is just a bad we're gonna all I think we can all just move on that virtually nobody likes throwing errors yes it's the worst design pattern of all time agreed I don't have to say anything okay uh stir convert stir convert is the stupidest thing ever thought who hurts you I'm gonna say that saying stir conver the stupidest thing ever thought is the stupidest thing ever thought I just want you to know for a second here let's just play a little game let's go play a little game called what does node do okay we're gonna do parse int I'm GNA pass it an empty string that's Ro about to make a whole new event called what does node do I'm gonna do number passing an empty string zero which one do you want to choose today I don't know all right let's try this again number 07 Fu that's not a number it's just not a number okay we can all agree that's not a number parse int that's actually seven it makes sense to me okay I'm just saying stir convert maybe isn't that dumb just maybe there's something to it you don't get it okay this is my favorite one this is my favorite one are you ready for this one parcent 0.05 Z 0.005 0 0 point Z five okay there tough guy I get it it makes I get it you just don't get it you just don't know how it's used skill issue okay skill it's a skill issue it I I get it and the real ones know okay the real ones understand what's happening whatever but here's the best part are you ready for this one I'm G to take this I'm gonna go like this I'm going to put little parentheses around this and I'm going go like this two string it's still the same answer right I'm GNA go to number the threads are going everywhere I it seems like there's just two complete different people created these two methods like two separate teams entirely like departments a ain't nobody ain't nobody understand this one I I I get why it happens but nonetheless it is crazy all right you can Shadow Global functions and will get surprising results directly in the runtime without any errors as globals are overridden I.E Len function can be overridden Okay I uh I fair if that's true big if true big if true okay I you can you can also kind of do this in typescript too like I validated this on stream like that are like keywords that you can overwrite uh in typescript or JavaScript and they will be handled as as uh you know variables or constants not all of them because I'm pretty sure go allows you to rewrite any uh keyword into uh a separate uh variable constant but I Tred to do it in typescript majority you can still do it so I don't know yeah yeah uh I mean to be completely fair I can also just like json.parse equals function whoa whoa so I mean you can you can kind of go you can kind of go wild yeah you know it's not like it's a it's a it's a zero this is not some sort of like one can only do something bad and the other can't okay I can I can edit prototypes I can go deep on the JavaScript okay we can go deep all right uh Magic AIT method I agree I think AIT was a mistake uh because it makes testing really hard I so I honestly the magic init method like why but why does it make testing hard what is what's so bad about it I couldn't if you do it a default value on a module right so there's some default values that are set up and then you start calling into functions and maybe some stake gets oopsy daisi and gets changed a little bit every other method now getting or every other test could have some weird kind of default anit values that they maybe aren't expecting you now have built in a State machine inside of testing and stuff like that I think there's like a little bit of careful when it comes to a knit mhm you know I just a little bit careful I I prefer just a you know just know that it can it can have some weirdness to it okay and sure I do also agree that in the main function a knit is it's nice yeah all right slice capacity gotcha with pass by value versus reference can you explain this one to me as someone who's a Layman well what do you mean so like if I'm asking you what do you mean what do you mean when you say this I'm asking what you what do you mean which which one of us doesn't know what the other person is saying no I okay so this is kind of like I'm not I'm not super strong at go so in my head a slice is a pointer into an array in which has a length off that has a length associated with it mhm so you can in my head a slice would be be something that does not have capacity and it does not have Okay so a slice does have capacity and length so I think I just have these things uh incorrect here hold on a pend in the case uh input and output variable are different slice has both length and capacity okay so slice is effectively the dynamic array an array can have many slices pointing to it okay you don't pass slice as and slice since it passed by ref by default okay the main thing uh is about ref vers Value Pass particular method receivers oh yeah but method receivers I get that but he's talking about slices particular with passing by ref versus value so that's what I'm trying to get is I don't really know the terms quite well for go and what they call Slice versus what they call an array uh slice is sugar on an array okay slice is the dynamic array okay that's okay that's what I was thinking so when you do something like uh length let's equals elements and slice yeah it's a dynamic array all right so if I take a dynamic array I guess this is a question for everybody just so I can maybe better understand this whole thing okay can we can we just agree that maybe I am I'm I can be the dumb one here let's see no I'm the dumb one that's my role here I that's why I'm hired to be here right now right uh I go like this right so I is that is that not valid go are we not doing valid go uh int is not a generic type oh come on what's what's what's the way to create this thing do I go like this to create the thing I know there's a way to do a literal isn't there can you not do a literal do I have to do that whole like make in no not map string come on all right right so then if I go a doesn't uh let's see doesn't B let's see B has some sort of can't I do some sort of zero to five some sort of syntax like that or is it 0 five right is that fair is b a copy or a reference why are you muted you muted yourself milk hello hey hi it's a copy of a copy of a it's a ref oh okay people are confused whether is it a copy or is it not a copy it's a copy okay okay so and then if I pass either A or B to a function it's passed as a reference correct if you pass B into a function oh people are saying bro is sleeping okay people are saying is it a copy or not a copy damn it people why are you guys being this way now we're in a huge debate I think this proves a Reddit point that this is messy okay okay Reddit Point proved nobody knows what it is because I I just simply haven't played with the the array versus slice business okay uh I thought it was a reference a is a pointer one length one this one uh B is pointer one length two cap one it's a ref or reverse I forgot okay maybe there's something that okay now I just need to go learn the actual language a little bit better on this one our references into a window of the underlying array correct but then if what happen if you add what happen can does that mean I can append on B can I go b equals append B I'm fairly sure it's a copy like where does a get appended to as well and does this one get appended to does it overwrite part of a that's what I need to know so that's what I don't know which is which one it's doing and since I can't since chat is literally giving me many different takes here we're just not going to do it it's a freaking reference no I okay I think the problem is is that we may be using uh it's a copy I think yeah I think it a pend is a copy whatever oh we'll we'll figure it out later we're going to figure out later I'm not even looking at you guys anymore okay you guys are all stupid including me I might be the stupid one here easy to shoot yourself on the foot Classic on the foot shot on the foot with go Channel routine by getting a deadlock or out ofhand go routines the compiler does not uh does not yes of course race conditions are never prevented this just happens there's no typing like an arc or something that enforces it uh no send yeah this feels like uh a user issue like a like literally a skill issue this one reach me like a skill issue without properly setting and closing your your channels like obviously can have some serious like issues and Deadlocks but I mean in go like it's the easiest thing to do uh to do this thing like I think out of all languages go is the easiest one to just Define your go channels put data in there put data Out close them at the end of function defer all that like it's very baked into language so yeah I don't know this definitely seems like a skill issue I would say that go by far is the easiest async like mental model of all time so I'm I mean the only thing that makes Russ a little bit better is that it forces you to use a mutex anytime you want to access or mutate a shared resource so that's nice typescript it just doesn't have more than one it's it's single execution I say that very specifically because it can still be multiple uh it can still be multiple uh uh threads going on underneath the hood but it's single execution so you don't you don't there's no such thing as a mutex right you don't what are you doing all right let's see no more on the foot shooting uh a on a lesser note no map filter reduced that's coming right that's a part of that is either a part of things or is coming right that came out in 21 the bakedin library has methods for slices for maps that have these like quality of life functions which was the same like the version before introduced uh Min and Max quality life functions and I think they added standard libraries for handling to this as well okay that's what I thought I thought this was relatively and when I say relatively recent I mean in the last six months which is definitely longer than 17 days ago yes right definitely okay acing communication and interrupting the uh the parallel operations is not easy no promise all race all settled uh I mean there's weight groups right that's pretty much what you do yep yep I don't know I don't think that that's very hard I mean it's just like a a function promises areas they're they're not great no but I mean it's stop you can it's a primitive right the weight group is a primitive that you can just kind of control and and stop and pass into into knowledge and I don't know i' say that this is you can't interrupt skill issue yeah yeah okay creating non-trivial higher order function that can satisfy the type system again Beyond trivial case you wouldn't understand a real girl is not easy as the type system is too rigid hence curring SLP partial functions are very difficult to get right and go even though it is a functional language it's not fun not a functional language it's a first class function functions are first class language no go is officially a functional language now Rex like starting after seeven since 17 days ago go is a functional language L plus ratio plus go is a functional language yeah oh camel has some competition officially go promotes imperative and mutable code patterns by passing pointers uh for a function Lang for a functional language which makes code uh predictably harder first off I love imperative okay I'm going to just throw that out there I'm an imperative Fanboy I do wish it was mute was what you opt into versus mute is or read only is what you opt into I do prefer that pattern but to me this is just I mean I'm not really sure where to go with this one other than yep that's the Paradigm they wanted yep they just chose they just chose that one it's the same point with the oop and like the porish O implementation that's not how like this one's this this is the way it was designed the other one it was designed not to have that yeah mocking for test is also clunky and not pretty that's second part bizarre first part may be true I guess I haven't done enough testing to know I don't I don't agree with this like there's I think testing well mocking is very very kind of nice to do and handle in go honestly you could create a bunch of mocks for a bunch of function you can pass in where to get the reference for your mocks and then they're easy to use you create fakes all that uh I don't know but the like and testing is like built in it's very nice uh I don't know this one it's pretty and it's not clunky so just fully disagree with this testing one yeah the pretty part's kind of funny uh I don't really understand that one okay anyways let's see and that's it the only good thing are are easy parallelism with foot guns that's a good thing compiled to Binary more performance low Ram I think and go let's see everything related to go runtime but most things are aesthetic uh features or missing in the go language itself are peer peer inconveniences which is a shame typescript is just insanely superior to the go type system and it's just very difficult to like go even though I know the language I just enjoy writing typescript a lot more than go and get very very surprised when go developers say that go is the best language syntax typ system no one says go is the best type system no one has ever said that I don't think anyone has ever said that ever nobody no I've never met someone that's like you know what the best type system there ever has been in go go the one that comes with the box of Crayola crayons yeah go has like the pass for having type safety but it's like one of the lowest level of implementations like it's like yeah yeah on paper you it is you know you have type safety but it's like it's not too advanced it doesn't have all like the sugar that really make it you know very nice to handle and get very exotic with it just it just has it to be in the club that this a type type safely type language me just tweet that one tweet it all it's a perfect tweet it's a perfect tweet it's a perfect tweet uh all right typescript just insanely better than go in every way in every way like literally uh so overall I'd say that this is a great example of when you program a language you don't want to go into the language trying to make it the language you know you use the language you know as a stepping stone right like okay I know what classes are but this thing does these strs plus fun you know pointer receivers okay I see how that okay so it does it this way you know like you use it as a jumping as a as a stepping stone you don't use it as a lens you look at a language in right and so I find that that's you know that's that's how I like to learn though is that I take the languages I know and I try to apply it to the language I'm attempting to learn and then I slowly over time try to do it in their way and try to learn their way of doing things because ultimately that's where you're going to get all the convenience from and so I don't know it just seems strange that you just can't make go typescript I wish yeah I think I wish this person if they went through a different kind of Route could have actually made a really strong argument here it's like not necessarily that typ is better than go or even vice versa but like the pros and cons of both languages right and you could have had a list of like these are the great things about go here are the bad things about go you could do the same with typescript and you could have had like an argument like yeah you know what based on this I would use oneing for one purpose or if you're programming and you know you have to use I don't know uh go routines or whatever you can use go and and stuff like that but this is just very like here's 32 reasons I can just think of that are just programming level like just high level programming points I'm just gonna write and try to spin as cons for go yeah uh anyways it's it's pretty fun I think it does point out Json is kind of a pain and go there's some things that I don't like about Json it's not uh but to be fair Json literally stands for JavaScript object notation it is obviously going to always have the best support in JavaScript because it literally is Javascript yep lit literally it is Javascript the Jon one the Json one yeah the nil pointer the the references and the advanced type safety that you know like the no enums the lack of lack of good generics um those are all like very fairly valid points that you can't really argue against but it's kind of like how much of a length of JavaScript are looking at this right like are you giving go the fair shot of Defending itself agreed agreed well Melky uh oopsies I just exposed her chat to everybody I knew I was going to do that I knew it I knew it I knew I should have switched but I didn't your the dick picks are out no no remove this this has end the stream end the stream this is I need to get my PR team on this right now you should right now I hope they're not written in go it's in not I don't know go Superior I I'm actually a rust developer so this whole time just masqueraded as a go developer the worst part of JavaScript is it can't easily use Go's in coding job encoding format it is very annoying that they can't easily do that they should just be able to do that uh all right anyways well hey thank you very much for this I appreciate you thank you prime I appreciate this I liked the 32 point I wish I could tell people the the back and forth we had about like are you coming onto my stream are you coming on to my stream it's like I'll see you Wednesday I'm like I'm coming back Thursday Wednesday I can't wait for Wednesday it kept happening I I don't know how manytimes we missed each other all right are you ready the name is the Mela Jen
Info
Channel: ThePrimeTime
Views: 235,824
Rating: undefined out of 5
Keywords: programming, computer, software, software engineer, software engineering, program, development, developing, developer, developers, web design, web developer, web development, programmer humor, humor, memes, software memes, engineer, engineering, Regex, regexs, regexes, netflix, vscode, vscode engineer, vscode plugins, Lenovo, customer service
Id: lvKQh3Od6V4
Channel Id: undefined
Length: 69min 29sec (4169 seconds)
Published: Fri Sep 15 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.