Re: [PATCH 7/9] test: ruby: use much more standard Ruby idioms

Subject: Re: [PATCH 7/9] test: ruby: use much more standard Ruby idioms

Date: Sun, 2 May 2021 17:11:40 -0500

To: David Bremner

Cc: notmuch@notmuchmail.org

From: Felipe Contreras


On Sun, May 2, 2021 at 6:07 AM David Bremner <david@tethera.net> wrote:

> The downside to these changes is that they make the tests harder for the
> non-rubyist (i.e. me) to read. So I'm not (yet) convinced this is a good change.

Yeah, but what about the rubyists? I have *never* seen the `for`
statement used anywhere. It's basically the first thing you learn in
Ruby, right after variables and objects[1].

  File.open('README').each { |l| puts l }

It also matches the notmuch_rb_threads_each () C function, which BTW
should return an Enumerator when no block is given, in order to match
other `each` methods:

    File.open('README').each # this returns an Enumerator

Being more familiar with Ruby can only improve the Ruby bindings.

Cheers.

[1] http://docs.ruby-doc.com/docs/ProgrammingRuby/

-- 
Felipe Contreras
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: