ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:124905] [Ruby Feature#21932] `MatchData#get_int`
@ 2026-03-03 12:29 nobu (Nobuyoshi Nakada) via ruby-core
  2026-03-04  1:16 ` [ruby-core:124916] " zenspider (Ryan Davis) via ruby-core
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: nobu (Nobuyoshi Nakada) via ruby-core @ 2026-03-03 12:29 UTC (permalink / raw)
  To: ruby-core; +Cc: nobu (Nobuyoshi Nakada)

Issue #21932 has been reported by nobu (Nobuyoshi Nakada).

----------------------------------------
Feature #21932: `MatchData#get_int`
https://bugs.ruby-lang.org/issues/21932

* Author: nobu (Nobuyoshi Nakada)
* Status: Open
----------------------------------------
This is suggested by @akr today, `$~.get_int(1)` is equivalent to `$1.to_i` but does not create the intermediate string object.



-- 
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/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:124916] [Ruby Feature#21932] `MatchData#get_int`
  2026-03-03 12:29 [ruby-core:124905] [Ruby Feature#21932] `MatchData#get_int` nobu (Nobuyoshi Nakada) via ruby-core
@ 2026-03-04  1:16 ` zenspider (Ryan Davis) via ruby-core
  2026-03-04  8:35 ` [ruby-core:124917] " nobu (Nobuyoshi Nakada) via ruby-core
  2026-03-06  9:16 ` [ruby-core:124937] " kou (Kouhei Sutou) via ruby-core
  2 siblings, 0 replies; 4+ messages in thread
From: zenspider (Ryan Davis) via ruby-core @ 2026-03-04  1:16 UTC (permalink / raw)
  To: ruby-core; +Cc: zenspider (Ryan Davis)

Issue #21932 has been updated by zenspider (Ryan Davis).


Tried to add a comment to your commit but github is being very sketchy today.

In the method comment on the impl side, you have examples for parsing a date... but IDGI... 1/2/10 are supposed to be the base arg, right? Base 1?


----------------------------------------
Feature #21932: `MatchData#get_int`
https://bugs.ruby-lang.org/issues/21932#change-116577

* Author: nobu (Nobuyoshi Nakada)
* Status: Open
----------------------------------------
This is suggested by @akr today, `$~.get_int(1)` is equivalent to `$1.to_i` but does not create the intermediate string object.

https://github.com/nobu/ruby/tree/match-get_int



-- 
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/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:124917] [Ruby Feature#21932] `MatchData#get_int`
  2026-03-03 12:29 [ruby-core:124905] [Ruby Feature#21932] `MatchData#get_int` nobu (Nobuyoshi Nakada) via ruby-core
  2026-03-04  1:16 ` [ruby-core:124916] " zenspider (Ryan Davis) via ruby-core
@ 2026-03-04  8:35 ` nobu (Nobuyoshi Nakada) via ruby-core
  2026-03-06  9:16 ` [ruby-core:124937] " kou (Kouhei Sutou) via ruby-core
  2 siblings, 0 replies; 4+ messages in thread
From: nobu (Nobuyoshi Nakada) via ruby-core @ 2026-03-04  8:35 UTC (permalink / raw)
  To: ruby-core; +Cc: nobu (Nobuyoshi Nakada)

Issue #21932 has been updated by nobu (Nobuyoshi Nakada).


zenspider (Ryan Davis) wrote in #note-2:
> In the method comment on the impl side, you have examples for parsing a date... but IDGI... 1/2/10 are supposed to be the base arg, right? Base 1?

I can't get from where the example comes.

Do you want to mean something like this?
```ruby
/\d+/.match("1/2/10").get_int(0)    # => 1
/\d+/.match("1/2/10").get_int(0, 1) # invalid radix 1 (ArgumentError)
```


----------------------------------------
Feature #21932: `MatchData#get_int`
https://bugs.ruby-lang.org/issues/21932#change-116578

* Author: nobu (Nobuyoshi Nakada)
* Status: Open
----------------------------------------
This is suggested by @akr today, `$~.get_int(1)` is equivalent to `$1.to_i` but does not create the intermediate string object.

https://github.com/nobu/ruby/tree/match-get_int



-- 
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/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:124937] [Ruby Feature#21932] `MatchData#get_int`
  2026-03-03 12:29 [ruby-core:124905] [Ruby Feature#21932] `MatchData#get_int` nobu (Nobuyoshi Nakada) via ruby-core
  2026-03-04  1:16 ` [ruby-core:124916] " zenspider (Ryan Davis) via ruby-core
  2026-03-04  8:35 ` [ruby-core:124917] " nobu (Nobuyoshi Nakada) via ruby-core
@ 2026-03-06  9:16 ` kou (Kouhei Sutou) via ruby-core
  2 siblings, 0 replies; 4+ messages in thread
From: kou (Kouhei Sutou) via ruby-core @ 2026-03-06  9:16 UTC (permalink / raw)
  To: ruby-core; +Cc: kou (Kouhei Sutou)

Issue #21932 has been updated by kou (Kouhei Sutou).


FYI: strscan will use `integer_at` not `get_int`: https://github.com/ruby/strscan/pull/192#issuecomment-4002582149

----------------------------------------
Feature #21932: `MatchData#get_int`
https://bugs.ruby-lang.org/issues/21932#change-116603

* Author: nobu (Nobuyoshi Nakada)
* Status: Open
----------------------------------------
This is suggested by @akr today, `$~.get_int(1)` is equivalent to `$1.to_i` but does not create the intermediate string object.

https://github.com/nobu/ruby/tree/match-get_int



-- 
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/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-03-06  9:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-03 12:29 [ruby-core:124905] [Ruby Feature#21932] `MatchData#get_int` nobu (Nobuyoshi Nakada) via ruby-core
2026-03-04  1:16 ` [ruby-core:124916] " zenspider (Ryan Davis) via ruby-core
2026-03-04  8:35 ` [ruby-core:124917] " nobu (Nobuyoshi Nakada) via ruby-core
2026-03-06  9:16 ` [ruby-core:124937] " kou (Kouhei Sutou) via ruby-core

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 NNTP newsgroup(s).