@@robergroso yes, exactly. Try catch can lead to a lot of nesting in specific scenarios. Go eliminate that. There's many if statements because you are actually error handling in pretty much every scenario. I bet most Javascript, or Python devs don't handle errors even 25% of the time, purely because they don't even think about it.
@@chrikkeThat is a bit of because the error handling in go is very nice, cause that makes you think on handling possible errors, what in another langs probably you wouldn’t do
It's not between go's version vs exceptions. The Return type has existed for decades now and Go's version is just pretty terrible for a rather new language.
It took me five days to learn Go to the point where I was able to create a project that was used in a massive content delivery production environment for five+ years.
@@himbary Of writing software in general? About 40 years. I'm finding the learning curve for Rust to be a lot steeper - more like C++ when I first started learning that back in 1989 or so.
@@davidgillies620 If you would recommend a programming language, for someone like me: chemical engineer, mostly wants to use programming to make life easier, like data cleanup, some loops for calculations. It's stuff that I now use VBA for, with the help of co-pilot. I'm a very much beginner in programming, again, I mainly use copilot and the record function in Excel at the moment, but I would add programming to my skill set.
I code for 16 years, using PHP in the begining and Java most of time. So error handling and concurrency is part of my daily routine. However, I have to agree, error handling in Go is cons and pros at same time. I start thinking I was coding in 80s, then I understood we should never leaver 80s coding style on error handling aspects.
Lack of packages is a good thing in my book, since it encourages you to write your own implementations instead of gluing packages together, while still having the most important ones i.e. web frameworks, Markdown parsers, Raylib, etc.
@@yewo.m true, although it still feels largely the same. Although, in Rust the pattern matching still feels like a glorified if statement. I do like it though.
@@BigMonkeyKnowsthe magic of match and if let patterns is the ability to deconstruct structs and enums. Once you start doing that it feels less like a stand-in for a switch statement.
@@darkmastergraham you are correct I change my stance on this. Not from Rust, but from Zig. I do love the switch statements and pattern matching far more than Go’s error handling.
Man, go error handling thing is something I’m advocating so hard in js projects. People tend to throw errors on any occasion and then to have a master catch block which is a terrible idea from any side (well it’s good if you don’t want to handle any errors).
Recently i started to code in go, wasn't as straightforward to learn as the popular langs but once you ge the hang of it there's no going back i love it
I actually prefer errors as values over try/catch. So much that I started using this paradigm in JS as well. When you throw, you sometimes forget to catch, and sometimes you don't know where it's caught and how it's handled... Maybe it just throws again and isn't cought at the top... I just prefer the safety of returning errors. Especially since TS lets you safeguard your actual return values so they stay undefined before you handle the returned error. Ever since I started doing this, I NEVER had a reference or an uncaught error... Think about that...
The only real issue I have with Go's error handling is Go's error type is basically just a string. If you get an error back from an API that can fail in many different ways (some of which may be recoverable from) you basically have to do string parsing to determine how it should be handled. This can create some flimsy code where you're basically just hoping the vendor doesn't change the error message on you
You can define error types on the Error interface, they're just string backed. That doesn't mean you can't use static typing to determine what kind of error was returned. LIke anything, if the vendor implementation is bad, the vendor implementation is bad. That's not the language's fault.
It makes you handle errors as you get it. All script kiddies spending hours to configure IDE. Even the most basic LSPs can give snippets one way or another. How is it verbose? Its readable and straightforward. Anything else is insanely worse. Go principle and most important aspect is keeping it simple. If you're gonna complain about verbosity you should also explain what you think would be better. It doesnt do anything complicated that other languages with error as values do like rust. Concurrency is so easy and it just works OOTB. Comes with toolchain for race analysis, prof, GC inspection. Good luck doing the same in java or any other GC. (GC languages cuz its clear we're talking about backend). Channels are amazing yet so simple. You can learn the whole language and necessary stuff in a day or two. Learning the Go way takes a bit of time but still way better than learning the intricacies of javascript. I urge Nodejs people to check it out. Its 100% worth it. Makes you better programmer.
kotlin next would be amazing. Its java but better. And its *advertised as 100% java compatible BUT it really sucks so your standered and external libraries are not fun. But use it for general purpose not just android apps
Go's error handling to me, as a non-Go programmer, is a lesson on how to make my code more readable in other languages In fact, i see a lot of this at my workplace, in our Python services.
If Go's concurrency model is more intuitive to you then Python's, you either are doing it wrong or you're only half a layer deep. it's much more complicated depending on the pattern you pick (i.e. a pipeline is much more complicated than 'parrallel execution')
Ironically, the Go error handling style is taking over Node/TypeScript now. People are ditching try/catch in favor of returning multiple values (including an optional error) within an object.
I think it's fair to say that everyone who's used both exception-based and value-based error handling will prefer the latter for anything that is not a throwaway scratch project. It's one very important pillar to Rust's appeal, for example.
You should totally look into the D programming language. It's like C++ but easier, more readable and comes with automatic memory management by default (can be disabled/controlled).
I love go, it’s by far my most favorite language of all languages I either really learned or just took a few days to tinker around with. I’m nowadays using it for everything I do, only using Java where I have to (like writing extensions to existing Java apps), or obliviously JavaScript for the web itself (although the GoT(T)H stack is my absolute favorite: Go, Tailwind, optionally Templ instead of the stdlib templates and HTMX. No more JavaScript for 95% of everything and the client decides the state. 1000x more performant than any React or even Svelte). The only downside imo really is error handling. I totally understand the why and I would prefer it every day over the way Java does it with try-catches/throws, or JavaScript that just doesn’t have built in errors, but it can get a bit repetitive at points. That’s why I’m so much for the error handler proposal, which basically makes it so that you can set, at any point in your code, a error handler that will handle all errors coming after it. A function returns a value and an error? You would only (unless you wanna handle this one yourself explicitly) do value := myFunc() instead of value, err := myFunc(). If an error is actually returned, the next error handler will be „searched“ and called, so it goes up the stack. If there is one a few lines up or at the beginning of the function, it’ll use that one, if there’s not, it’ll go into the function which has called this function and do the same search there, until it finds an error handler - until it’s at the main function which would then do a panic as no error handler has ever been set. It’s obviously a compile time feature, so it doesn’t actually search through anything, it would just when compiling find where the next one is and basically call that as a closure effectively. This way, I could just set a error handler inside my HTTP handler, then do a bunch of things such as requesting database, then another service, call some API, just many things that could error and if any of these does, the HTTP request couldn’t be completed anyways and therefore the error handler would just send a simple 500 internal server error status to the client. And, as I said, you could at any point just set a new handler, for example to handle your microservice errors differently when calling them, so that e.g. you could (re)connect to a different instance, retry the request and then successfully return what you wanted. And after that function returns, the microservice handler is no longer in scope and any further errors would be handled by the HTTP one. But, and that’s the whole point about go, if my only complain is that error handling is better than in any other language, but yet not perfect, then the language is doing something right. From my knowledge Go has the biggest std by far compared to every other language. For most of my projects I don’t really use external libraries, because you don’t have to. Dependency injection? Exists as per language spec, no library needed. Compressing files, modifying them and then uploading them via SFTP/SSH? Yeah all built it. Structured logging for my web server with a really nice router? Also in the std (the latter one since the last version). I could go on and on and on, but the std is sooooo extensive, it’s insane. Sometimes I’m searching for a package just for the first result being an stdlib package.. haha.
I came from Python and learned Go recently and I definitely prefer Go. I think it's more beginner friendly in that you can learn a lot more by not using libraries
Error handling in Go was not designed for handling system errors like out of memory or keyboard interrupts. So that's a huge downside to give up on Go for me
In C, which Go is a descendant of, you write your own packages. Even when they exist, C programmers will write their own version. It is a totally different mindset to Python and JS.
@@TJackson736 Literally every python package is made with C and C++, i really look up to C and C++ coders knowing I'll never be one of them (I know C# so maybe yes)
@@hamm8934 what does it help, when it does not bring us forward? They keep on writing operating systems and the computers are idle, because an OS alone does not help.
why is everyone talking about the speed of Golang? I compared the basic example, 1000 Fibonacci numbers on js, python, go Result: Python: 88 ms Js: 90 ms GoRunCommand: 612ms GoBuild: 467 ms GoStartExe: 512 ms Where is the speed???
i never understand why it's so loved for backends because JSON parsing is hell 😂 Also it won't compile if there is an unused import. So often you can't just comment out code to test smth real quick if that is the only use of that import
My complaint about Go is that it’s not fancy 😂. It’s a fantastic language (I use it) and super fast, but I miss the syntactic sugar of Ruby or functional languages. I started learning F# (but hardly anyone uses it) and now OCaml because I want more magic haha. When I’m ready to give up if statements I’ll dive into Gleam 😁
@@osbourn5772Yes. For anyone who missed what was implied: Rust enums, like Result, are discriminated unions, meaning that the same memory space is used for either the success value or error value, while Go uses what is basically a tupple where space for both the success and error values are allocated even though only 1 is actually used.
@@emilnymann8723Yes, space on the stack is allocated for nil in Go. If you have an error, then it's allocated on the heap, and the pointer is on the stack. In Rust, on the stack in the area of the returned value there's a discriminate, and then space for either the value or the error inline on the stack.
Straight to the point with cons! I tried to make a simple roguelike engine to learn Go and this language felt fascinating. But in practice, when it comes to communicating outside of your program like querying redis or http or db it becomes garbage. 50% of your code is literally THE SAME THREE LINES of code. This is so cringe. At least they can provide some kind of error return operator (ahem throw ahem) to make it much more shorter right? Hell no, Go is designed to be simplistic. Even ternary operator does not exist in Go, so... I am thinking to learn Gleam or Zig
@@nithinsvarrier670 is quicker. Not more efficient. For example breakpoints can have conditions applied to them (i.e. "only break when x > 7 and y != null" or whatever). To do the same with print statements, you'd have to write that if statement
I feel being so called out when you say python and javascript and do the boom sound lmao. Didn't expect to be so called out, i usually use those and java. The moment i touch something like c++ already make me realize i am ultra spoiled
@@muyou0107and then you're dropping yourself out of half the community support Not to mention how bad PIP is, python is a badly designed language and JS is used in fields it should not be used in
Hi Lewis i have a question I have about 3 years of experience with Python and i started learning web development about 1.5 year . I began with frontend (HTML, CSS, and JavaScript) and then moved on to backend with Django and MySQL.I haven't learned API yet. I also hold a master's degree in urban planning (not related to IT). Can you help me to move forward and give some advice. And if you can tell me how/when i can begin starting applaying to jobs. I hope you read it and give me your thoughts.
Go error handling is unreadable because the only readable error handling people are used to is NO error handling. It is way more readable then try {} catch () {}
I really tried. I made an array of size 5. Then I made a slice on the middle 3 elements. Adding an item on the slice mutates the last element of the parent array. Adding another one decouples the slice from the underlying array, so if you then alter the first item on the slice, the not-longer underlying array is unchanged. Wtf? Who designs a language like that? Why are even slices mutable?
Dude, readability is the last possible thing someone could say about Go error handling. If you can't read that, you can't program or read. It is a small set of three iconic lines. Skill issue!
Go error handling isn't as smart as that of Rust or Gleam, and that sucks because Go is a new language like Rust, but they only chose to simplify things, instead of also making them better.
Where do you guys learn languages? I wanna start c++ but I don't know where I can study it. I don't want to stick to just HTML and CSS ( my Junior Highschool Teacher taught me HTML and CSS )
@@arc8218if rust is his first language then he will have a hard time getting a grip on the language so in my humble opinion start with any other programming language like c to understand what is what and move to rust to develop a scalable application. That will be great.
The lack of packages is a good thing. Otherwise we’ll end up like the js people who can’t figure out whether a number is even or odd without a library.
if you really want to be a better programmer, then use C, not c#, not c++, standard C using standard C with a good debugger, you'll actually learn how to program 1000 times better, you'll get a deeper understanding of how computer works... Once you start reverse engineering your own work,(code) !
Yes and no. Programming languages influence the way you think about problems. So if you know an OO language, learning another OO language should be easy. But when you start to learn eg. a functional language as a second language, knowing OO will be a burden.
Good for you. I like Python style but it's slow and janky. Wouldn't want to build a production app out of it. Go on the other hand has been a rock-solid rocket ship. I run hundreds of millions of concurrent TLS connections with it at an order of magnitude cheaper than comparables like erlang.
The road to hell is paved with `pip install`
npm install would like to have a word with you
Skill issue
It is not
I think never before have I installed pip dependencies without getting at least 2 errors in the process
@@saumytiwari7 one combination of words to prove the contrary: ai tensorflow cuda python packages and the 15+ gb folders
😂 The sound effects and editing when you mentioned the Python and JS packages situation just had me
python package add-two-numbers 0.1.1
The error handling eliminates try/catch hell. It reduces readabilty because you are actually handling errors
"try" bad lot of "if" good
@@robergroso yes, exactly.
Try catch can lead to a lot of nesting in specific scenarios. Go eliminate that. There's many if statements because you are actually error handling in pretty much every scenario.
I bet most Javascript, or Python devs don't handle errors even 25% of the time, purely because they don't even think about it.
@@chrikkeThat is a bit of because the error handling in go is very nice, cause that makes you think on handling possible errors, what in another langs probably you wouldn’t do
I 100% would agree if rusts question mark operator didn’t exist. Would love something like that in go for the common case
It's not between go's version vs exceptions. The Return type has existed for decades now and Go's version is just pretty terrible for a rather new language.
It took me five days to learn Go to the point where I was able to create a project that was used in a massive content delivery production environment for five+ years.
how much experience do you have?
@@himbary Of writing software in general? About 40 years. I'm finding the learning curve for Rust to be a lot steeper - more like C++ when I first started learning that back in 1989 or so.
@@davidgillies620 If you would recommend a programming language, for someone like me: chemical engineer, mostly wants to use programming to make life easier, like data cleanup, some loops for calculations. It's stuff that I now use VBA for, with the help of co-pilot.
I'm a very much beginner in programming, again, I mainly use copilot and the record function in Excel at the moment, but I would add programming to my skill set.
that's about average
@@davidgillies620I was thinking about learning Rust but their foundation 😭
The error handling is pretty great.
The Lack of packages and comprehensive documentation for beginner is the current issue i think
some mf stuck at GOPATH and never recover ever since
@@jensenraylight8011 it happened 🤝
the reason why there is a lack of packages is because the standard library has 98% of what you need for a web server
Gopath is no longer an issue.
@@jensenraylight8011 hasn’t been an issue for a while now actually.
I code for 16 years, using PHP in the begining and Java most of time. So error handling and concurrency is part of my daily routine. However, I have to agree, error handling in Go is cons and pros at same time. I start thinking I was coding in 80s, then I understood we should never leaver 80s coding style on error handling aspects.
For younger devs is Java still popular or should newer devs learn python? 🤔
@guccigreatness4925 They should learn how computers work and how we can interact with them through programming. So any language works fine.
@@guccigreatness4925 python or go
Its esy to do a lot of things in python, and its pretty easy to learn too! So.i would recommend C lol
@@rbda8921 C is the best
I started learning go this month and i love it. My first language was C
Go definitely has a C feel to it.
Describing Go’s stdlib as minimal is wild! It’s got so many packages!
Lack of packages is a good thing in my book, since it encourages you to write your own implementations instead of gluing packages together, while still having the most important ones i.e. web frameworks, Markdown parsers, Raylib, etc.
Exactly. I don’t want it to end like Python or even worse JS where people need a library to do the most basic of tasks.
I also use to hate the error handling, but it makes more sense this way. I can’t go back to try/catch.
hahaha me too. try-catch actually is starting to look worse.
It's not a binary set of options like that. Like there's also the option of Algebraic Data Types
@@yewo.m true, although it still feels largely the same. Although, in Rust the pattern matching still feels like a glorified if statement. I do like it though.
@@BigMonkeyKnowsthe magic of match and if let patterns is the ability to deconstruct structs and enums. Once you start doing that it feels less like a stand-in for a switch statement.
@@darkmastergraham you are correct I change my stance on this. Not from Rust, but from Zig. I do love the switch statements and pattern matching far more than Go’s error handling.
go stdlib is minimal yet so so so powerful
Man, go error handling thing is something I’m advocating so hard in js projects. People tend to throw errors on any occasion and then to have a master catch block which is a terrible idea from any side (well it’s good if you don’t want to handle any errors).
Recently i started to code in go, wasn't as straightforward to learn as the popular langs but once you ge the hang of it there's no going back i love it
Eh… the syntax itself is very simple. Some concepts are a bit different though.
I actually prefer errors as values over try/catch. So much that I started using this paradigm in JS as well.
When you throw, you sometimes forget to catch, and sometimes you don't know where it's caught and how it's handled... Maybe it just throws again and isn't cought at the top... I just prefer the safety of returning errors. Especially since TS lets you safeguard your actual return values so they stay undefined before you handle the returned error.
Ever since I started doing this, I NEVER had a reference or an uncaught error... Think about that...
The only real issue I have with Go's error handling is Go's error type is basically just a string. If you get an error back from an API that can fail in many different ways (some of which may be recoverable from) you basically have to do string parsing to determine how it should be handled. This can create some flimsy code where you're basically just hoping the vendor doesn't change the error message on you
You can define error types on the Error interface, they're just string backed. That doesn't mean you can't use static typing to determine what kind of error was returned. LIke anything, if the vendor implementation is bad, the vendor implementation is bad. That's not the language's fault.
It makes you handle errors as you get it. All script kiddies spending hours to configure IDE. Even the most basic LSPs can give snippets one way or another. How is it verbose? Its readable and straightforward. Anything else is insanely worse. Go principle and most important aspect is keeping it simple. If you're gonna complain about verbosity you should also explain what you think would be better. It doesnt do anything complicated that other languages with error as values do like rust. Concurrency is so easy and it just works OOTB. Comes with toolchain for race analysis, prof, GC inspection. Good luck doing the same in java or any other GC. (GC languages cuz its clear we're talking about backend). Channels are amazing yet so simple. You can learn the whole language and necessary stuff in a day or two. Learning the Go way takes a bit of time but still way better than learning the intricacies of javascript. I urge Nodejs people to check it out. Its 100% worth it. Makes you better programmer.
kotlin next would be amazing. Its java but better. And its *advertised as 100% java compatible BUT it really sucks so your standered and external libraries are not fun. But use it for general purpose not just android apps
I hear too many good things about Kotlin. Never gave it a try.
I tried it out, unfortunately I don't know how to make a Kotlin window and mess around with graphics, that's probably because it's for mobile apps
@@javacrow_ then start small. Kotlin can be used for backends too. Like web apps with ktor
@@CodingWithLewis what!?
@@javacrow_ You should have tried compose multiplatform
Go's error handling to me, as a non-Go programmer, is a lesson on how to make my code more readable in other languages
In fact, i see a lot of this at my workplace, in our Python services.
If Go's concurrency model is more intuitive to you then Python's, you either are doing it wrong or you're only half a layer deep.
it's much more complicated depending on the pattern you pick (i.e. a pipeline is much more complicated than 'parrallel execution')
What are you learning right now?
Working on Bootstrap
c++
Working on some Python automation things
And learning JavaScript
ur mom
I’ve learned Go because I work with Kubernetes, I wanted to understand its underlying details.
Go? More like goat, like lewis.
🥰🥰
The goat in programming or...?
@@SakuraScythethe goat in f1 😅
@@srdjantrail Lewis Hamilton? 😭
@@SakuraScythe yes!
You should try gleam! It also does Errors as values but in a more elegant way and it can compile to js or Erlang
Ironically, the Go error handling style is taking over Node/TypeScript now. People are ditching try/catch in favor of returning multiple values (including an optional error) within an object.
I think it's fair to say that everyone who's used both exception-based and value-based error handling will prefer the latter for anything that is not a throwaway scratch project. It's one very important pillar to Rust's appeal, for example.
Refactoring my own code I always find unhandled errors. I'll trade verboseness for good error handling every day.
Error handling is verbose because in go you actually handle the errors unlike javascript
You should totally look into the D programming language.
It's like C++ but easier, more readable and comes with automatic memory management by default (can be disabled/controlled).
I love go, it’s by far my most favorite language of all languages I either really learned or just took a few days to tinker around with. I’m nowadays using it for everything I do, only using Java where I have to (like writing extensions to existing Java apps), or obliviously JavaScript for the web itself (although the GoT(T)H stack is my absolute favorite: Go, Tailwind, optionally Templ instead of the stdlib templates and HTMX. No more JavaScript for 95% of everything and the client decides the state. 1000x more performant than any React or even Svelte).
The only downside imo really is error handling. I totally understand the why and I would prefer it every day over the way Java does it with try-catches/throws, or JavaScript that just doesn’t have built in errors, but it can get a bit repetitive at points. That’s why I’m so much for the error handler proposal, which basically makes it so that you can set, at any point in your code, a error handler that will handle all errors coming after it. A function returns a value and an error? You would only (unless you wanna handle this one yourself explicitly) do value := myFunc() instead of value, err := myFunc(). If an error is actually returned, the next error handler will be „searched“ and called, so it goes up the stack. If there is one a few lines up or at the beginning of the function, it’ll use that one, if there’s not, it’ll go into the function which has called this function and do the same search there, until it finds an error handler - until it’s at the main function which would then do a panic as no error handler has ever been set. It’s obviously a compile time feature, so it doesn’t actually search through anything, it would just when compiling find where the next one is and basically call that as a closure effectively.
This way, I could just set a error handler inside my HTTP handler, then do a bunch of things such as requesting database, then another service, call some API, just many things that could error and if any of these does, the HTTP request couldn’t be completed anyways and therefore the error handler would just send a simple 500 internal server error status to the client. And, as I said, you could at any point just set a new handler, for example to handle your microservice errors differently when calling them, so that e.g. you could (re)connect to a different instance, retry the request and then successfully return what you wanted. And after that function returns, the microservice handler is no longer in scope and any further errors would be handled by the HTTP one.
But, and that’s the whole point about go, if my only complain is that error handling is better than in any other language, but yet not perfect, then the language is doing something right. From my knowledge Go has the biggest std by far compared to every other language. For most of my projects I don’t really use external libraries, because you don’t have to. Dependency injection? Exists as per language spec, no library needed. Compressing files, modifying them and then uploading them via SFTP/SSH? Yeah all built it. Structured logging for my web server with a really nice router? Also in the std (the latter one since the last version). I could go on and on and on, but the std is sooooo extensive, it’s insane. Sometimes I’m searching for a package just for the first result being an stdlib package.. haha.
0:04 that hand positioning seems like a RSI waiting to happen ?! 😮
That hurts just to watch. Yeah the keyboard is far too close.
I came from Python and learned Go recently and I definitely prefer Go. I think it's more beginner friendly in that you can learn a lot more by not using libraries
Looks like a lot of people never actually looked at Python's stdlib because everyone just uses pip
Error handling in Go was not designed for handling system errors like out of memory or keyboard interrupts. So that's a huge downside to give up on Go for me
Go was initially made as a systems language. It can easily handle those. I wrote a Go cli last month and handled both of those in many places🙃
As far as low level languages go C will be my go-to
Rust better 😎
As a python spoiled child, no packages goes hard
In C, which Go is a descendant of, you write your own packages. Even when they exist, C programmers will write their own version. It is a totally different mindset to Python and JS.
@@TJackson736 Literally every python package is made with C and C++, i really look up to C and C++ coders knowing I'll never be one of them (I know C# so maybe yes)
@@TJackson736so C-programmers do reinvent the wheel as often as they can?
@@ThomasVWorm this is why C devs are on average better programmers
@@hamm8934 what does it help, when it does not bring us forward? They keep on writing operating systems and the computers are idle, because an OS alone does not help.
Ngl I thought the go mascot was him drawn in cartoon at first...
why is everyone talking about the speed of Golang? I compared the basic example, 1000 Fibonacci numbers on js, python, go
Result:
Python: 88 ms
Js: 90 ms
GoRunCommand: 612ms
GoBuild: 467 ms
GoStartExe: 512 ms
Where is the speed???
Most javascript codes would be a lot better if people didn't insist on importing loads of unnecessary dependencies
i never understand why it's so loved for backends because JSON parsing is hell 😂
Also it won't compile if there is an unused import. So often you can't just comment out code to test smth real quick if that is the only use of that import
True, I use GoLand and it automatically takes out the unused import for me.
@@CodingWithLewis really? Thats cool. For me the compiler just complaints and aborts. I never found a flag that maybe overrides this
@@tidy5156you can just put an underscore before the import and the compiler will allow the unused import.
@@tidy5156just put an underscore before the import name
@@hamm8934sounds tedious bit thanks
My complaint about Go is that it’s not fancy 😂. It’s a fantastic language (I use it) and super fast, but I miss the syntactic sugar of Ruby or functional languages. I started learning F# (but hardly anyone uses it) and now OCaml because I want more magic haha. When I’m ready to give up if statements I’ll dive into Gleam 😁
those print statement sometime still needed for logic flaw
Rust error handling is similar, but can be less verbose using the `?` operator.
Rust has semantically better error handling. In Rust, you return an error, in Go, you return both an error and a junk value.
@@osbourn5772Yes. For anyone who missed what was implied: Rust enums, like Result, are discriminated unions, meaning that the same memory space is used for either the success value or error value, while Go uses what is basically a tupple where space for both the success and error values are allocated even though only 1 is actually used.
@@jaysistar2711 nil is not reallocated for every variable pointer.
@@emilnymann8723Yes, space on the stack is allocated for nil in Go. If you have an error, then it's allocated on the heap, and the pointer is on the stack. In Rust, on the stack in the area of the returned value there's a discriminate, and then space for either the value or the error inline on the stack.
Make more Go content ^^
Go's package system is killing me. Hello from cpp.
Straight to the point with cons!
I tried to make a simple roguelike engine to learn Go and this language felt fascinating. But in practice, when it comes to communicating outside of your program like querying redis or http or db it becomes garbage. 50% of your code is literally THE SAME THREE LINES of code. This is so cringe. At least they can provide some kind of error return operator (ahem throw ahem) to make it much more shorter right? Hell no, Go is designed to be simplistic. Even ternary operator does not exist in Go, so... I am thinking to learn Gleam or Zig
I'm not really sure what you mean.. you can handle an error in 1 line or incorporate with your function call & panic exists. idk
"You don't have to write those print statements"... are you telling me you don't know how to use breakpoints and watches??
I dont, and I have met no one that does, so what? nobody uses that thing
@@brandonjoaocastillo7490 time to level up my guy.
Well most times writing print statements are far more efficient that setting up dap
@@brandonjoaocastillo7490 do you work as a developer?
@@nithinsvarrier670 is quicker. Not more efficient. For example breakpoints can have conditions applied to them (i.e. "only break when x > 7 and y != null" or whatever). To do the same with print statements, you'd have to write that if statement
Why were you using threadpool executor?
Python asyncio has better handling for concurrency
I feel being so called out when you say python and javascript and do the boom sound lmao. Didn't expect to be so called out, i usually use those and java. The moment i touch something like c++ already make me realize i am ultra spoiled
The packages are what I dislike so much about Python and JS
You can choose not to use them though...
@@muyou0107and then you're dropping yourself out of half the community support
Not to mention how bad PIP is, python is a badly designed language and JS is used in fields it should not be used in
I’d love a link to the project if possible a tutorial
Well back to being straight bro❤😂
JavaScript and Python spoilt me with too many packages 😂😂
>"error handling is verbose"
>literally just 'if error { handle_error() }'
god bless
Golangers would rather reinvent the wheel than have a well coded library.
Would you recommend it?
Absolutely! Even though I complained about the verbosity of the error handling... it forces you to actually take into account errors that can happen.
Hi Lewis i have a question
I have about 3 years of experience with Python and i started learning web development about 1.5 year .
I began with frontend (HTML, CSS, and JavaScript) and then moved on to backend with Django and MySQL.I haven't learned API yet.
I also hold a master's degree in urban planning (not related to IT).
Can you help me to move forward and give some advice.
And if you can tell me how/when i can begin starting applaying to jobs.
I hope you read it and give me your thoughts.
Go error handling is unreadable because the only readable error handling people are used to is NO error handling.
It is way more readable then try {} catch () {}
add-two-numbers and sum packages are crazy, reminds me of is-odd
How did u learn it?? I wanna try it too
I lost it when he said he comes from Python 😂
I really tried. I made an array of size 5. Then I made a slice on the middle 3 elements. Adding an item on the slice mutates the last element of the parent array. Adding another one decouples the slice from the underlying array, so if you then alter the first item on the slice, the not-longer underlying array is unchanged. Wtf? Who designs a language like that? Why are even slices mutable?
Pointers and pass by reference...
Where you learn it at?
Dude, readability is the last possible thing someone could say about Go error handling. If you can't read that, you can't program or read. It is a small set of three iconic lines. Skill issue!
No they don't spoil you. You are just not handling errors because the language doesn't signal to you that there COULD be an error.
bro errors as values >>>>..
It's my favourite programming language
he finally gave up on rust lol
Would u say more intuitive than C/C++?
Go error handling isn't as smart as that of Rust or Gleam, and that sucks because Go is a new language like Rust, but they only chose to simplify things, instead of also making them better.
Try Nim next please
What keyboard is that?
What's your theme when you are talking about go error handling pros.
Where do you guys learn languages? I wanna start c++ but I don't know where I can study it. I don't want to stick to just HTML and CSS ( my Junior Highschool Teacher taught me HTML and CSS )
Just start Rust, its better
Learn it from anywhere, freecodecamp, yt videos etc
As long u learn using practice not just reading and watching
@@arc8218if rust is his first language then he will have a hard time getting a grip on the language so in my humble opinion start with any other programming language like c to understand what is what and move to rust to develop a scalable application. That will be great.
@@arc8218 where is that
@@arc8218 and if rust is a Language, sorry bro but I really need c++ for Arduino and ESP32 that's why I want to study that
So many people with less than 2 hours of go experience in this comment section writing off go for the silliest reasons lol
Data in go is king
Oddly enough the forced err handling got me to write better err handling logic in other languages 😅
You can write apps for TL draw?
Just create a function for error handling put pass err and string message in go lang
Wouldn't it be easier to create a function that does the same thing, in Python?
The lack of packages is a good thing. Otherwise we’ll end up like the js people who can’t figure out whether a number is even or odd without a library.
everything is a package in go isn't it
if you really want to be a better programmer, then use C, not c#, not c++, standard C
using standard C with a good debugger, you'll actually learn how to program 1000 times better, you'll get a deeper understanding of how computer works...
Once you start reverse engineering your own work,(code) !
The amount of errors handled in 2-3 go projects is always > the total errors handled by a js or python dev😂 its a fact
Go is fantastic, keep your dirty JavaScript hands off my boy.
Welcome Gopher
It's "gopher"
go write once compile for everything.😊 know rust does but I'm not a 10x developer.
Any good resources to learn GOlang?
ray william johnson
i was about to start cooking you haha
The GoPro grammar language
Lol, the error handling in go is a cruel joke
Is it true that when you learn a language you can learn other languages much easier??? 🤔🤔🤔🤔
110%
For some people
But if you learn js/python first 😅😅 now that's problem
Yes and no.
Programming languages influence the way you think about problems. So if you know an OO language, learning another OO language should be easy.
But when you start to learn eg. a functional language as a second language, knowing OO will be a burden.
@@arc8218My reaction be like: 💀💀
yes, I learnt c++, and now I can learn a language in a couple of days(basic syntax 10 minutes than the resr for the language specific syntax)
Error handling SHOULD be verbose
😅😅😅 I mean, I come from Python and Javascript:
Oooh hell nooh!!!
😅😅😅
Can go replace python?
Good for you. I like Python style but it's slow and janky. Wouldn't want to build a production app out of it. Go on the other hand has been a rock-solid rocket ship. I run hundreds of millions of concurrent TLS connections with it at an order of magnitude cheaper than comparables like erlang.
I just wish golang could be less verbose
加上rust的error handling 的话 我会用go的
Now try installing a C library
Basic maths package 😂
Habibi.. try c# ❤🎉
Google promoting thier ad without tag!!