Tag: ruby
-
A random assortment of Rust notes
I thought I’d jot down some notes about using Rust that wouldn’t have made it as their own blog posts: You can’t use anonymous functions for control flow In Ruby, you can return from almost anywhere in a function: Unfortunately, it also returns nonsense if the inputs break the invariant that an even number exists…
-
Oxidization: Nested hashes
This might be an idiosyncrasy of mine, but I tend to use hashes a lot in Ruby. For instance, recently I was working on a code challenge involving ordering food. There were different categories of courses (breakfast, lunch, and dinner) and different categories of foods (main dish, side dish, etc.), and you need both in…
-
Ruby has economy-class functions
Ruby has economy-class functions, not first-class functions. And that’s okay! It’s a great language anyway.
-
Writing a Rust gem from scratch
This is a followup to the last post. Instead of using the template rust_ruby_example gem, we’ll make one from scratch. Make sure to go back over the “Using a rubygems fork” section because we’ll be using it heavily during this post, as well!
-
Sneak preview: Writing Ruby gem native extensions in Rust
In December 2021, Ian Ker-Seymer (@ianks) submitted a pull request to add a CargoBuilder class for handling Rust code in gems, enabling native extensions in Rust! I was so excited, I had to try it out, even though it hadn’t been merged yet. A lot of maintainers are showing interest and pitching in, so I…
-
Contributing to Artichoke in Rust
Yesterday, I eked out a bit of time to contribute to Artichoke in Rust, in no small part due to the maintainer @lopopolo: Artichoke is an implementation of Ruby written in the Rust programming language. The issue I worked on was to expose a newly stabilized method in Artichoke’s implementation of the Ruby String class.…
-
Trying Elixir as a Rubyist
I’ve been working through Dave Thomas’s fantastic book Programming Elixir 1.6 in hopes of using Phoenix LiveView, and it has been really interesting, coming from Ruby. A lot of syntax is familiar enough to be alluring, but unfamiliar enough to trip me up. For instance, even something as simple as an if block was hard…