• Stop Using next in Ruby Loops

    LLM-generated Ruby code tends to reach for next inside .each loops. It works, but it’s not idiomatic. When you find yourself using next, there’s almost always a more expressive alternative using Enumerable methods.

    A Simple Example

    Consider this loop that collects names of active users:

    names = []
    users.each do |user|
      next if user.inactive?
    
      names << user.name
    end
    

    The next if is doing filtering, but it doesn’t say filtering. It says “skip this one,” which forces the reader to mentally invert the condition to understand what’s being kept. Compare:

    names = users.reject(&:inactive?).map(&:name)
    

    The intent is explicit: reject inactive users, then map to names. Each method communicates exactly one operation.

    Discrete Steps

    Enumerable methods let you express collection processing as discrete, named steps: select, reject, map, filter_map. Each step communicates intent. When you use next inside .each, you combine filtering and transformation into one opaque block. The reader has to mentally simulate the loop to understand what it does.

    Named methods are also composable. You can add, remove, or reorder steps without restructuring the entire loop. A chain of Enumerable methods reads as a description of what the code does, not how it iterates.

    A More Complex Example

    Here’s a loop that processes orders with multiple conditions:

    summaries = []
    orders.each do |order|
      next if order.cancelled?
      next if order.total < 100
      next unless order.region == "US"
    
      summaries << {
        id: order.id,
        total: order.total,
        customer: order.customer_name
      }
    end
    

    Three next statements, each encoding a different filter. You have to read all of them to understand which orders survive. Compare:

    summaries = orders
      .reject(&:cancelled?)
      .select { |o| o.total >= 100 }
      .select { |o| o.region == "US" }
      .map { |o| { id: o.id, total: o.total, customer: o.customer_name } }
    

    Each step is readable in isolation. The pipeline reads as a description: reject cancelled orders, keep those above $100 in the US region, then transform to summaries.

    One Operation Per Step

    Enumerable has methods like filter_map that combine more than one operation. They can be useful, but at the cost of obscuring intent. Consider:

    results = items
      .select(&:valid?)
      .filter_map { |item| item.compute_value }
    

    filter_map maps and removes nil results in one pass. But the reader has to know that to understand what’s happening. Compare:

    results = items
      .select(&:valid?)
      .map { |item| item.compute_value }
      .compact
    

    Each step does one thing: select valid items, transform them, remove nils. The tradeoff is worth considering – filter_map is more concise, but .map { ... }.compact makes every operation visible.

    What About Performance?

    The obvious objection: chaining creates intermediate arrays, while the .each loop iterates only once. In practice, this rarely matters. But when it does, that’s what lazy is for:

    summaries = orders
      .lazy
      .reject(&:cancelled?)
      .select { |o| o.total >= 100 }
      .select { |o| o.region == "US" }
      .map { |o| { id: o.id, total: o.total, customer: o.customer_name } }
      .to_a
    

    Same expressive chain, single-pass iteration. You get clarity and performance.

    Conclusion

    When you see next in a loop, treat it as a signal. There’s probably an Enumerable method that says what you mean more clearly.

    Read on →

  • The REPL: Issue 138 - February 2026

    GitButler CLI Is Really Good

    GitButler is new to me. At first glance, the ergonomics look a lot like jj. I don’t feel the pain as much with git. Sure, I work on different branches all the time, but switching is not a problem, and neither is cherry-picking. Stacked PRs are more painful, but git rebase --update-refs goes a long way. It still requires multiple pushes, but I don’t do that often. Worth watching.

    Demystifying evals for AI agents

    Anthropic published a deep dive into evaluations for AI agents and how to maintain quality. The research they share publicly is impressive.

    Read on →

  • I've Disallowed LLMs

    As an experiment, I changed the robots.txt on this blog to disallow LLMs from crawling it. I saw a reference – lost now in my notes – to something like this:

    # Disallow AI training
    
    # OpenAI - https://platform.openai.com/docs/bots
    User-agent: GPTBot
    Disallow: /
    
    # Anthropic - https://support.claude.com/en/articles/8896518-does-anthropic-crawl-data-from-the-web-and-how-can-site-owners-block-the-crawler
    User-agent: ClaudeBot
    User-agent: anthropic-ai
    Disallow: /
    
    # Google - https://developers.google.com/crawling/docs/crawlers-fetchers/google-common-crawlers#google-extended
    User-agent: Google-Extended
    Disallow: /
    
    # Apple - https://support.apple.com/en-us/119829
    User-agent: Applebot-Extended
    Disallow: /
    
    # Common Crawl - https://commoncrawl.org/ccbot
    User-agent: CCBot
    Disallow: /
    
    # Meta/Facebook - https://developers.facebook.com/docs/sharing/webmasters/web-crawlers
    User-agent: Meta-ExternalAgent
    User-agent: FacebookBot
    Disallow: /
    
    # ByteDance/TikTok
    User-agent: Bytespider
    Disallow: /
    
    # Amazon - https://developer.amazon.com/amazonbot
    User-agent: Amazonbot
    Disallow: /
    
    # Ai2 - https://allenai.org/crawler
    User-agent: AI2Bot
    Disallow: /
    
    # Bright Data - https://brightdata.com/brightbot
    User-agent: Brightbot 1.0
    Disallow: /
    
    # Huawei/PetalBot
    User-agent: PetalBot
    Disallow: /
    
    # Meltwater/YaK
    User-agent: YaK
    Disallow: /
    
    # Yandex
    User-agent: YandexAdditional
    User-agent: YandexAdditionalBot
    Disallow: /
    
    # A draft standards-based way to disable AI training.
    User-Agent: *
    # https://www.ietf.org/archive/id/draft-ietf-aipref-attach-04.html
    # Content-Usage: train-ai=n
    Allow: /
    
    # Last updated: January 10, 2026
    

    That change went live on 2026-01-13. Now, after roughly a month, I can see what effect it had on traffic, as measured in my server logs rather than JS artifacts injected on page load.

    Traffic from 2025-12 to 2026-02

    Can you spot when the traffic dropped off? Neither can I. 🤷🏻‍♂️

    Read on →

  • The REPL: Issue 137 - January 2026

    AI is a horse

    This is very clever!

    Karpathy on Claude

    AI capabilities are moving fast. Its hard to keep up and develop personal workflows. I find it useful to read what others are doing and take what fits me.

    Taming Claude Code

    In the same vein as above. I’m experimenting with creating skills after reading.

    Read on →

  • I've been POSSE all along

    I recently learned that Publish (on your) Own Site, Syndicate Elsewhere POSSE is a thing – about 10 years old. It caught me by surprise. Not because I find it novel, but because I’ve always followed these principles.

    In 1995 I learned about the web. Connecting to the internet meant using the same phone line for calls. You connected on-demand, when you wanted to check email or browse. Most people got their email address from their ISP. I realized that switching ISPs would mean changing my email. So I got an address I thought would last forever: ylan@email.com. People didn’t believe me when I told them that was actually my address! I forget what happened to email.com, and the domain now sits unused (it redirects to company.ai). But at some point, the terms of service didn’t agree with me. Being technically minded, I realized the only way to avoid churning my email address was to buy my own domain. I could (and have) changed providers, but my email would stay the same. At the close of last century I bought segal-family.com, and have used it ever since.

    In 2021, I decided to start this blog. When looking for hosting providers, CMSs, and static site generators, I read some advice: Whatever you pick, make sure you own your content. Don’t let a third party own it who might change their terms later. Given my email address experience, this seemed obvious. Fool me once, shame on you. Fool me twice, shame on me.

    Don’t get me wrong – I’m not putting anyone down for reviving an older idea. I’m happy that POSSE has been gathering steam. It’s better for the web. I look forward to a more interconnected future. And if it helps to have a catchy acronym, that’s great too.

    Read on →