matltc 8 hours ago

If you found this interesting, and especially if you write Ruby, I cannot recommend Metaprogramming Ruby highly enough. Fundamentally changed the way I think about programming, and opened my mind to what is possible when one frees themselves from dogmatic, generic best practices. It covers these topics in great detail, and uses examples from ActiveRecord and many other gems' implementations of them.

twiss 11 hours ago
    class Order < ActiveRecord::Base
      enum :status, { pending: 0, paid: 1, shipped: 2, refunded: 3 }

      def shippable?
        paid? && !refunded?
      end
    end

Bit off-topic but if `:status` is an enum, then `paid? && !refunded?` is equivalent to `paid?`

  • rapind 11 hours ago

    It should be yes. Well it's ruby, so you could probably overwrite it with your own `def paid?`, but I suspect the `&& !refunded?` is just cruft.

WesolyKubeczek 11 hours ago

Opens the article

> The title was bait to get you to open this article. But

Closes the article

  • dmix 11 hours ago

    Your loss, it's a well written article.

    • tessierashpool 11 hours ago

      incorrect on two levels.

      first, if somebody tries to cheat you, and you walk away, that's just not what losing looks like. that's the right move.

      second, no, it's not good. it opens with clickbait, pivots to some other topic, so the first question is "what is it really about?"

      they don't tell you what it's really about. they make you read the whole article to find out.

      even if you're willing to accept people acting in bad faith, you still need to be able to assess if the article's worth reading. the only signal on that topic is the disrespect they showed to your normal process for doing so.

      it would have been easy to fix with "here's what the article is about, and why the hyperbole almost works:" followed by a sentence which did that job.

      they don't do that. instead they introduce a character without explaining who he is, so you have to click a link to find out (but again, no signal as to whether or not you should care). then you get a whole bunch of intricate code specifics, again without any signal about why you should care.

      it's a very consistent theme. you're not going to get a good article out of an experience where you have to click external links and go several paragraphs deep just before learning "it's probably still going to be about enums" and "these people have no respect for either my time or the general principle that writing should be clear."

      • dmix 10 hours ago

        I don't take headlines that seriously. I only care if they wrote something interesting.

        Drive-by HN commenters always obsess about accuracy of headlines, I prefer reading the actual articles and judging it on that. I read the whole thing and it discussed some difficult open source work they are doing on Ruby in a way that kept my attention, shrug.

      • pitched 10 hours ago

        The title is relevant to the article. The first line walking back the statement was a bit cowardly but understandable given how easily angered it could make readers and that fact makes it funny and the reason I kept reading. The rest of the article backs up the title.

        Also Aaron is on the Rails Core team and probably colleague of the author at Shopify. Sam is also a colleague of the author at Shopify. The target audience of this article is people deep in that same culture and definitely not you.

      • majorchord 9 hours ago

        > even if you're willing to accept people acting in bad faith

        I consider this entire comment to be acting in bad faith.

        There can be other valid perspectives than your own.

  • kristianp 9 hours ago

    I think a lot of people on hn intuit that Rails isn't actually a jit compiler from their knowledge of what Rails actually is and haven't bothered to open the article or comment here on it either. It's clearly some kind of clickbaity metaphor, but I wouldn't know what, as I didn't click on the article either.