[#115244] [Ruby master Feature#19987] add sample method to Range — "horv77@... (Andras Horvath) via ruby-core" <ruby-core@...>
Issue #19987 has been reported by horv77@protonmail.com (Andras Horvath).
6 messages
2023/11/05
[#115247] [Ruby master Feature#19988] AI for inner code behavior analysis at runtime — "horv77@... (Andras Horvath) via ruby-core" <ruby-core@...>
Issue #19988 has been reported by horv77@protonmail.com (Andras Horvath).
3 messages
2023/11/05
[#115404] Ruby 3.2.2 - rbconfig.rb's MAKEFILE_CONFIG — Jay Mav via ruby-core <ruby-core@...>
Hello Ruby Dev Team,
4 messages
2023/11/17
[ruby-core:115322] [Ruby master Feature#14548] Allow some_array&.[1] to be a valid syntax
From:
"Eregon (Benoit Daloze) via ruby-core" <ruby-core@...>
Date:
2023-11-09 14:30:48 UTC
List:
ruby-core #115322
Issue #14548 has been updated by Eregon (Benoit Daloze). What about using `dig` for this like `array_or_nil.dig(index)` and adding `class NilClass; def dig(*) = nil; end`? There is also nothing wrong with `array_or_nil && array_or_nil[index]`. IMO these `?.[` look too cryptic. ---------------------------------------- Feature #14548: Allow some_array&.[1] to be a valid syntax https://bugs.ruby-lang.org/issues/14548#change-105242 * Author: rosenfeld (Rodrigo Rosenfeld Rosas) * Status: Open * Priority: Normal * Assignee: matz (Yukihiro Matsumoto) ---------------------------------------- Currently, Ruby allows accessing an array's index while testing whether the array is not nil with this syntax: `my_array&.[](1)`. I've always found this awkward but didn't mind about suggesting anything to improve this. I was just reading about how JavaScript is probably going to support myArray?.[1] and found that it read good enough for me. So I'd like to propose about the same syntax, replacing ?. with the Ruby equivalent &. instead. How does that look like to you? -- 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/