Meta-x meta-redux| Meta Redux
Heredocs in Ruby are quite common, quite flexible, and… somewhat weird. Still, this doesn’t stop people from suggesting more features for them, like this (rejected) proposal for an anonymous heredocs syntax: # regular Ruby code Markdown.render <<~MARKDOWN # Hello there This is a Markdown file. See? 1. This is a list 2. With items 3. And more items MARKDOWN # proposed syntax Markdown.render <<~ # Hello there This is a Markdown file. See? 1. This is a list 2. With items 3. And more items ~>...| Meta Redux
Great news, everyone - CIDER 1.18 (“Athens”) is out! This is a huge release that has an equal amount of new features, improvements to the existing ones, and also trimming down some capabilities in the name of improved efficiency and maintainability. I’m too lazy to write a long release announcement today, so I’ll just highlight the most important aspects of CIDER 1.18 and how they fit our broader vision for the future of CIDER. Let’s go! Reduced surface area CIDER 1.18 dropped suppo...| Meta Redux
One of Projectile’s key features has always been the ability to cache the files in a project, so next time need to do something with them you’d skip the potentially expensive project file indexing step. The feature has always worked reasonably well, but it suffered from a couple of design flaws that I’ve been meaning to address for a while: The cache for all projects is stored in the same file, which means that often you need to load information that you don’t really need. Also - stor...| Meta Redux
For ages dealing with Java sources in CIDER has been quite painful.1 Admittedly, much of the problems were related to an early design decision I made to look for the Java sources only in the classpath, as I assumed that would be easiest way to implement this. Boy, was I wrong! Countless of iterations and refinements to the original solution later, working with Java sources is still not easy. enrich-classpath made things better, but it required changes to the way CIDER (nREPL) was being starte...| Meta Redux
One of the hardest things for any project author is to figure out whether their perspective on a project is aligned with perspective of the project’s users. Henry Ford supposedly knew better than his customers what they needed, but if that’s true I’d say he was a rather special case. I’m often guessing what people need and would find useful, what their issues are and what tools are they using. From time to time I guess right, but often I guess wrong. A couple of notable examples immed...| Meta Redux
TL;DR You’ll find the survey here. It’s been a while since the first and only “State of CIDER” survey.1 Right after it happened in the end of 2019, the world went to shit and I kind of forgot about my intent to do the survey annually. 5 years later, it’s high time we get back on track! CIDER has changed a lot in the past 5 years. nREPL has changed a lot. The development tooling Clojure ecosystem has changed a lot. Even Emacs has changed a lot. I’m guessing your usage of CIDER has ...| Meta Redux
Recently I wrote that it was already possible to run RuboCop with Ruby’s new Prism parser, but that required a bit of manual work. I also outlined some plans to add built-in Prism support in RuboCop. 1 Today I’m happy to report that last week we’ve released RuboCop 1.62 which features (experimental) support for Prism! Now using RuboCop with Prism is just a matter of adding Prism to your Gemfile (assuming you’re using Bundler, that is): gem 'prism' and adding the following to your Rubo...| Meta Redux
Ruby is famous (infamous?) for giving us many ways to do the same thing. One aspect of this is that quite a few methods in core classes have aliases, especially in the Enumerable module. E.g.: collect -> map inject -> reduce detect -> find select -> find_all Most Rubyists are probably aware that the “original” method names (collect, inject, etc) were inspired by Smalltalk and later the aliases where added to reflect the naming trends in the functional programming community. Enumerable#sel...| Meta Redux
I guess most Rubyists know that you can use the methods Integer#succ1 and its alias Integer#next to increment a number. E.g.: 1.succ # => 2 The method is rarely used directly, but it’s used internally by ranges to compute the elements within the range boundaries: (1..10).to_a # => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] It’s not so widely known that strings also implement succ. The official docs describe String#succ like this: Returns the successor to str. The successor is calculated by increment...| Meta Redux
String#split is a pretty-well known and commonly used method. Still, its behaviour in some cases might surprise you: irb(main):001:0> 'foo.bar'.split('.') => ["foo", "bar"] irb(main):002:0> '...'.split('.') => [] irb(main):003:0> 'foo...'.split('.') => ["foo"] irb(main):004:0> 'foo'.split('.') => ["foo"] irb(main):005:0> ''.split('.') => [] No comment needed. Keep Ruby weird!| Meta Redux
Most Rubyists probably know that nil in Ruby is an instance of the singleton class NilClass. Because nil is a object like any other, we can actually invoke methods on it, and it turns out that NilClass provides a few - mostly conversion methods to other Ruby types. Let’s see some of those in action: irb(main):001:0> nil.to_h => {} irb(main):002:0> nil.to_a => [] irb(main):003:0> nil.to_s => "" irb(main):004:0> nil.to_f => 0.0 irb(main):005:0> nil.to_i => 0 irb(main):006:0> nil.to_c => (0+0i...| Meta Redux
By now probably most Rubists have heard of Prism (formerly know as YARP), the modern and (very) fast Ruby parser that’s aiming to replace all the existing Ruby parsers out there. Including RuboCop’s “own” parser (a.k.a whitequark/parser), which aimed to replace ripper and ruby_parser, back when it was created. I’ve been keeping an eye on Prism for while, as RuboCop has long been criticized for its choice of parser (and more specifically - for that parser being somewhat slow). That b...| Meta Redux