[#112457] [Ruby master Feature#19443] Cache `Process.pid` — "byroot (Jean Boussier) via ruby-core" <ruby-core@...>
Issue #19443 has been reported by byroot (Jean Boussier).
16 messages
2023/02/16
[#112584] [Ruby master Feature#19465] [PATCH] reuse open(2) from rb_file_load_ok on POSIX-like system — "normalperson (Eric Wong) via ruby-core" <ruby-core@...>
Issue #19465 has been reported by normalperson (Eric Wong).
9 messages
2023/02/25
[#112595] [Ruby master Feature#19465] [PATCH] reuse open(2) from rb_file_load_ok on POSIX-like system
— "nobu (Nobuyoshi Nakada) via ruby-core" <ruby-core@...>
2023/02/25
SXNzdWUgIzE5NDY1IGhhcyBiZWVuIHVwZGF0ZWQgYnkgbm9idSAoTm9idXlvc2hpIE5ha2FkYSku
[#112613] Re: [Ruby master Feature#19465] [PATCH] reuse open(2) from rb_file_load_ok on POSIX-like system
— Eric Wong via ruby-core <ruby-core@...>
2023/02/26
"nobu (Nobuyoshi Nakada) via ruby-core" <ruby-core@ml.ruby-lang.org> wrote:
[#112615] Re: [Ruby master Feature#19465] [PATCH] reuse open(2) from rb_file_load_ok on POSIX-like system
— SHIBATA Hiroshi via ruby-core <ruby-core@...>
2023/02/27
MzUxMzZlMWU5YzIzMmFkN2EwMzQwN2I5OTJiMmU4NmI2ZGY0M2Y2MyBpcyBicm9rZW4gd2l0aCBg
[#112626] Re: [Ruby master Feature#19465] [PATCH] reuse open(2) from rb_file_load_ok on POSIX-like system
— Eric Wong via ruby-core <ruby-core@...>
2023/02/28
```
[ruby-core:112380] [Ruby master Misc#16507] =~ vs include? or match?
From:
"rubyFeedback (robert heiler) via ruby-core" <ruby-core@...>
Date:
2023-02-12 09:58:00 UTC
List:
ruby-core #112380
Issue #16507 has been updated by rubyFeedback (robert heiler).
I can't speak for the ruby core team, but here is my rule-of-thumb in my
own ruby code "bases" out there.
I usually try to stick with the simplest choice possible, which in many
ways is .include?() for me.
Sometimes this is not possible, though, such as when the input is not so
simple (e. g. where a regex is more appropriate such as /\d{0,6}\.\d{3,6}/
like when the input can vary). Regexes are great in ruby; I think matz
liked them from the perl days. :)
I almost never use .match() or .match?() - and I think these are also
rare in other people's code bases out there.
I tend to use methods ending via "?" a lot. It is a bit like DSL-design
for me:
if object.can_do_this? or object.can_do_that?
end
I think it reads very nice. That is actually my recommendation too - if
you feel the readability is improved then use the methods.
The method .ci?() seems a bit short-ish. I would recommend against such
short method names; they rarely seem to improve a lot. I tend to use them
mostly when I need to do things where being succinct is important.
.mswin?() makes more sense. Even then I would perhaps consider using
two words, if that makes sense for the code you are working with.
In my opinion, when it really helps you maintain the code, and when it
leads to some clarity, using helper-methods is a good idea.
Perhaps if you want some more feedback from ruby core devs, it may help
if you could give a few more specific examples so they can look at
the instances where you thought that removing =~ would be a good idea.
Sometimes different ruby developers have a different focus and
priority for using certain constructs in their code. For me my own
code is very simple and readable, but I am sure for others it can
be very messy and unreadable (I try to stick to simplicity at all
times and avoid too complicated constructs; for instance I never use
"->" and other things, but I use blocks a LOT, so my code will have
tons of "if block_given?; yield = yielded" just to keep on working
with the variable. Blocks are great).
----------------------------------------
Misc #16507: =~ vs include? or match?
https://bugs.ruby-lang.org/issues/16507#change-101822
* Author: MSP-Greg (Greg L)
* Status: Open
* Priority: Normal
----------------------------------------
While working on getting the mswin build working on Actions, I thought adding mswin? and ci? methods to Minitest::Unit::Guard in tool/lib/minitest/unit.rb would be helpful.
Currently some tests are failing that are guarded/skipped based on ENV['APPVEYOR']. For ci?, I'd combine Travis, AppVeyor, & Actions.
There are quite a few instances where =~ is used for a boolean return. Would it be considered appropriate to replace those calls with include? or match?
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/