Go Is the New Ruby
00f.net
00f.net
It runs everywhere, is easy to learn and use and people who don't get it hate it with passion.
Anyway, comparing go documentation with rust docs, I'm surprised anyone can get any work done with rust.
Which is why it uses type erasure for generics rather than reification like C#.
That's an unexpected comment. Rust has among the best documentation I've seen, and arguably the best ecosystem around documentation, which helps a lot and encourage third party developers to write high quality doc. I understand when people complain about the learning curve (like this article, because fighting the borrowchecker is only a thing while learning) but docs, really?
https://doc.rust-lang.org/std/fmt/index.html
I don't know why I find Go's version easier to follow, but I do.
Across the ecosystem (and particularly the third-party culture of documentation) is much more important; in my own experience playing with both languages, I tended to encounter more useless 1-line descriptions in golang than I did in Rust.
Also golang struct descriptions always seem to be a bit lackluster..
But I can't point to any particular lib at the moment though.
the fmt docs are... not ideal. That said, there's a lot there, and it's all useful, but it's just tough. Frankly, I just punted on improving them, and haven't taken the time to do so in the years since.
- syntax highlighting
- a quick example of the feature
As far as I can tell, the best-documented approach is to use some external library and ignore the http support built into Rust.
https://docs.rs/http/0.1.19/http/request/index.html
"standard library" is probably not the correct term for this in Rust-world because it is under the "http" namespace rather than the "std" namespace. I just meant, "the stuff you use via typing `use http`".
I am comparing the experiences of:
1/ Trying to do some http requests in go, searching for "golang http", and coming across the fairly well documented standard "net/http" library in go, at https://golang.org/pkg/net/http/
2/ Trying to do some http requests in rust, searching for "rust http", and coming across this as the first result:
https://docs.rs/http/0.1.19/http/
which includes statements like
"It's intended that this crate is the "standard library" for HTTP clients and servers without dictating any particular implementation."
That's cool, I don't mind if no particular implementation is dictated to me. I just want to know how to use it by reading this documentation... but that never becomes possible.
You could say the problem isn't that rust is documented poorly, the problem is that the standard library is missing some things that are in the standard library of other languages, and it's those third-party libraries that are documented poorly.
“How to perform an http request in Rust” is a Google query that makes much more sense, and works for all the aforementioned languages.
Searching for [python http] works fine. Top result is this page:
https://docs.python.org/3/library/http.client.html
which explains precisely how to send http requests.
Searching for [nodejs http] works fine as well. You get this page:
https://nodejs.org/api/http.html
Which does, in fact, give you a library that can make http requests.
I won't dig into php and java because I'm not familiar enough with those languages to say what a decent way of sending http requests is.
Finally, searching for [how to perform an http request in rust] does not work! It sends you to https://docs.rs/http/0.1.5/http/request/index.html which is the same fundamentally broken library as you get with [rust http].
In conclusion, the Rust documentation is worse than any of Go, Python, or Node.
I suppose both Ruby and Go have less steep learning curves compared to Java/Kotlin/Scala.
I can't wait until Go v2 gets generics then I can use it like other statically-typed compiled, gc'd languages. At the rate of Go language development, Java might get coroutines and value-types before then.
I haven't used Rust but I read the "Rust where the compiler constantly shouts “fuck you”" quote differently. I read it as, where the non-existent Ruby compiler will shout “fuck you” in production.
"Go has become the new Ruby. A language I use to get things done, and enjoy programming again."
Good for him
It would be hard to find two more different major languages.
Go is underpowered, explicit, and statically typed; Ruby overpowered, implicit, and dynamically typed.
But I think they're alike because the author likes both of them.
True on so many levels. Learning other languages means learning a new way of thinking due to the reasons those languages were created in the first place. Even if you never change the language you use daily, learning other languages and doing small projects in them will make you better in your “home” language.
A few examples:
- We purchased a cheap USB duplicator (10 slots) to copy the contents from a master USB to the clones. It worked, but wasn't a great solution. It was slow, error prone and when it failed you never really knew what USB was having the issues (or what went wrong). Using a Golang backend and ReactJS frontend I created an alternative which had a nice GUI showing what files were copying, the percentages complete, error messages, etc. It was a far better solution and using Goroutines it was fun. We ended up scaling the system to 100 USB's at a time and that was fun to watch (lots of blinky lights :D). The solution didn't take much time to write (Golang was quick to learn) and we finished the duplication WAY sooner than the due date.
- We needed to automate a bunch of DNS stuff with CloudFlare. I ended up creating a parser for a custom config we wrote, hooked it up to CF's API and we ran it as a service. The language I used for this project was Nim[0]. I liked the syntax and the final binaries were TINY and FAST.
- More recently I was approached by an IT guy at the company that manages all of our software licenses. He showed me this command line tool he uses to query all licenses and goes through the cryptic output trying to figure out what licenses were being used, by whom, etc. I ended up using Go to parse the command and serve a ReactJS application with all sorts of bells and whistles (reports, history, alerts, etc). Since the application is browser-based he can even use it mobile which he loves.
- I've been working on some prototype BLE Mesh stuff in C, but that is a ways out and not yet worth mentioning much more.
Rust has held my interest for a while as well, just waiting for the right project to come along.
I do however use various charting libraries out there for ReactJS as they are typically quite well done and small in size. If I need something a little more custom I'll install D3 and build it out.
For backend I have used Node/Express quite a bit to serve API's and such. But as mentioned in my previous post lately I've been using system programming languages a lot more for building backend things mostly as a learning exercise and because I have the freedom to do that in my job.
Building out these tools and seeing them being used daily from nearly all employees in a ~400 person company is really rewarding. It really gives me a sense of appreciation for the work I do and I get a lot of good suggestions on how to improve the applications that in turn improve the work these employees do.
Other things I've used in the past for various projects include Ionic Framework & PhoneGap (mobile app), Zephyr RTOS (BLE Mesh Programming), React Native, Angular, Electron (Visitor Check In/Out Kiosks), and lots of CSS frameworks (too many to name).
No, you can't. Language constructs in Go allocate in ways that are not immediately obvious. When the GC runs, it still has to scan all of that memory, regardless of whether you preallocated it or not, which is especially unfortunate with a non-generational garbage collector like that of Go.
Also, I have to say that I really don't get it when people say that they have to think about the borrow checker for a long time before writing a program in Rust. That's not the case for me or anyone else I know.
Also, while the garbage collector may not be generational, it's mostly concurrent. Looks like GC pauses are below 1ms now?
Despite my annoyance with the direction that Go's taken since 1.10, this line really resonates with me.
TL;DR
Windows + PHP + slow laptop drove me to put away my childish anti-Google fears for a weekend and try Go, and for the first time since I started coding (with Pascal) I enjoyed programming.
Cool story:
Around late 2010, after a few years of using (btw, Arch) Linux exclusively, I was given a slow Windows laptop for work. The laptop came with Windows Vista IIRC and the whole experience of writing PHP code on an unfamiliar OS combined with a slow laptop was just misery - it was even worse than my memories of Windows ME/XP.
I tried everything to get a familiar Linux env going: Cygwin, msys, KDE... and it just added insult to injury.
Anyway, soon after, it was Go's birthday so it was in the news again and one weekend I decided to put away my childish anti-Google fears and try it and I never looked back.
Something about the simplicity, its lack of CMake, Makefiles, latest build-system-of-the-week, dynamic linking hell, C++ complexity, D and its 2 std libs, etc. was a breath of fresh air.
Before even falling in love the the concurrency primitives, I started writing "bash scripts" in Go - something I do to this day. I even started writing prototypes in Go to then port them to PHP and Python because I could write the inefficient, naive, brute-force code to validate an idea... and it'd still end up being faster and use less memory than the code the was deployed to production.
I later also discovered that my shitty naive linters written in Go that parsed and checked whole PHP packages every time I saved a file ran near instantly compared to the heavy disk-destroying IDE indexing - it was crazy.
https://luckyframework.org/ https://amberframework.org/ https://spider-gazelle.net/
That being said, someone said "screw that" and built Buffalo https://gobuffalo.io/en which is as close as you can get in Golang at the moment.
I mean you can, but "go advocates", would crap on your work with an endless litany of articles about why whatever you wrote shouldn't be used because it's not the "go way". Remember Martini? That's right you don't.
Fortunately for Go, the biggest pain in the ass when it comes to web development is kind of a solved problem with the use of JSON support in SQL Dbs. All you have to do then is un-serialize directly from the DB, which helps getting rid of ORM when building object graphs.
Buffalo uses code generation sure, but it doesn't make an extensive use of interface {} like Martini did, thus can't really be compared to Rails in terms of polymorphism.
Ruby has keyword arguments and optional arguments with defaults.
Among [many] other things.