ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:72334] [Ruby trunk - Feature #11100] Permit multiple captures with String[Regexp, ...]
@ 2015-12-18  4:13 Joseph Jones
  0 siblings, 0 replies; only message in thread
From: Joseph Jones @ 2015-12-18  4:13 UTC (permalink / raw)
  To: Ruby developers; +Cc: ruby-core

[-- Attachment #1: Type: text/plain, Size: 1368 bytes --]

Joseph Jones liked your message with Boxer. On December 10, 2015 at 16:35:21 MST, djberg96@gmail.com wrote:Issue #11100 has been updated by Daniel Berger.I support allowing multiple captures. I think the [1,2] syntax is the most intuitive.----------------------------------------Feature #11100: Permit multiple captures with String[Regexp, ...]https://bugs.ruby-lang.org/issues/11100#change-55454* Author: D.E. Akers* Status: Open* Priority: Normal* Assignee: ----------------------------------------I propose that if we are able to conveniently grab one capture with this method, we ought to be able to grab more than one. Still, there are some caveats worth considering:* It should return an array, but every other `#[]` variant returns a string or `nil`.* Should the argument be an array, or should the method be variadic? - Array argument looks a little "noisy"? `'123abc'[/(\d+)(\w+)/, [2, 1]]` - Variadic method requires intrusive modification of internal calls to `rb_str_subpat()`.* Complementary `#[]=` would be crpytic, overly complex, and likely go unused, but not adding it would break the symmetry.I realize this is essentially an outline of why not to implement this feature, but I figured I'd toss it out there for feedback. Thoughts?---Files--------------------------------string_slice_many_captures.patch (906 Bytes)-- https://bugs.ruby-lang.org/     

[-- Attachment #2: Type: text/html, Size: 1787 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-12-18  3:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-18  4:13 [ruby-core:72334] [Ruby trunk - Feature #11100] Permit multiple captures with String[Regexp, ...] Joseph Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).