![]() ![]() The fmt package is a built-in package with formatting, writing, and printing functionality in this case, the main function prints the string with the Println function of the fmt package.Īnother notable aspect of Go is its built-in support for concurrent programming. The main package is the entry point for all Go packages, and the main function is the entry point of a Go program. Here’s a simple Go “Hello, World!” program: package main ![]() Go aims to be clean and readable to foster understanding and maintainability. Which is on the list!).One of Go’s defining characteristics is its minimalist syntax. Suggests 4 different Error types I might have wanted to use there! (I wanted failure::Error, One last nice example: I forgot to import the right Error type. ![]() error: this function takes 1 parameter but 0 parameters were supplied Here I just think it’s nice that it underlines the exact code with the problem. Here’s another example of a simple error message: I accidentally left out the parameter to Err(). This error is incredibly helpful!! I just followed the instructions: I put ref x instead of xĪnd my program totally compiled!! This happens relatively often now – I just do what the compiler | | hint: to prevent move, use `ref x` or `ref mut x` Here’s the first one: error: cannot move out of borrowed content I just found all of these by scrolling back though my terminal. To show how Rust’s compiler is good: here are a few real examples of compiler error messages I’ve Examples of awesome compiler error messages from today So I don’t expect or want Rust to be “just as easy as (like compile-time thread safety guarantees!) where fundamentally you do need to think carefullyĪbout what your program is doing exactly. Think probably there’s some limit to how “easy” Rust can be! There are of course things about Rust Performance at all”), and I feel like they’ve really delivered on it.īut! When talking about the compiler I’ve tried to be careful to say “easier” instead of “easy” – I I love this approach (“we’re going to make it easier to use WITHOUT compromising reliablity or Various pillars we’ve talked about on this blog: Our approach with Rust has always been to bend the curve around tradeoffs, as embodied in the Small complexities entail glossing over safety holes or performance cliffs? Is “fighting with theīorrow checker” an inherent rite of passage for budding Rustaceans? Does removing papercuts and After all, Rust hasįocused on reliability and performance, and it’s easy to imagine that achieving those aims forcesĬompromises elsewhere-like the learning curve, or developer productivity. This is of course not by magic, it’s because of a huge amount of work on the part of RustĪ focus on productivity might seem at odds with some of Rust’s other goals. I’ve learned a lot more about Rust (I haven’t, yet!) I think it’s mostly because the compiler is I don’t spend as much time being frustrated with the Rust compiler anymore. Me do things I probably wouldn’t get done otherwise. I spend a lot of time being frustrated with the Rust compiler, but I still like it because it lets In 2016, my experience of using the Rust compiler was that it was hard. Last used Rust (for the same ruby profiler project) in May 2016. One cool thing about being a sporadic Rust user is seeing the huge improvements in the compiler! I Rust’s compiler is more helpful than it was in 2016 That feels really astonishing and magical to me, and I really don’t think I could have accomplished (from 1.9.1 to 2.5.0)! It works even if the Ruby program’s symbols are stripped and there’s no And it works! Like, I still have some work toĭo to get out the first release, but on my laptop it works across 35 different Ruby versions Maps, and the ability to read memory from the process. In 2013 I wrote a tiny 400-line “operating system’ in Rust (basically a small keyboardĭespite not having much Rust experience (less than 10 weeks of actively using it), I think Rust hasĪlready enabled me to do a lot of awesome things! Like – I’m writing a Ruby profiler in Rust whichĮxtracts Ruby stack traces from arbitrary Ruby programs with only access to its PID, its memory Rust, which is about 1300 lines of Rust code so far. I’m an intermediate Rust programmer (definitely not advanced!). Ideas for where Rust could go in the next year! (as a response to the call for community Think that’s really exciting! So I wanted to talk about why I like using Rust today, and a couple of Picked up Rust again, and the language is SO MUCH EASIER than it was the last time I tried it (May 2016). I’ve been using Rust on and off since late 2013. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |