ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:95699] [Ruby master Feature#16294] Make MatchData frozen and forbid MatchData#allocate
       [not found] <redmine.issue-16294.20191105125925@ruby-lang.org>
@ 2019-11-05 12:59 ` eregontp
  2019-11-06  0:05 ` [ruby-core:95712] [Ruby master Feature#16294] Make MatchData frozen and forbid MatchData.allocate nobu
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: eregontp @ 2019-11-05 12:59 UTC (permalink / raw)
  To: ruby-core

Issue #16294 has been reported by Eregon (Benoit Daloze).

----------------------------------------
Feature #16294: Make MatchData frozen and forbid MatchData#allocate
https://bugs.ruby-lang.org/issues/16294

* Author: Eregon (Benoit Daloze)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
Currently, `MatchData.allocate` is allowed, but almost every MatchData method called on it `raise TypeError, 'uninitialized Match'`.

I think MatchData should be frozen, none of its internal fields are mutable and I don't see any use case for storing instance variables on it.
Once frozen, we can implement MatchData#dup and #clone as just `return self`, and we don't need to check for the uninitialized case.
And Marshal can have special treatment to create an initialized MatchData directly.

My main motivation is looking at the code in TruffleRuby required to implement `MatchData.allocate` and check if it's initialized in so many places:
https://github.com/oracle/truffleruby/pull/1792/files

Thoughts? Anyone against?
cc @alanwu




-- 
https://bugs.ruby-lang.org/

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

* [ruby-core:95712] [Ruby master Feature#16294] Make MatchData frozen and forbid MatchData.allocate
       [not found] <redmine.issue-16294.20191105125925@ruby-lang.org>
  2019-11-05 12:59 ` [ruby-core:95699] [Ruby master Feature#16294] Make MatchData frozen and forbid MatchData#allocate eregontp
@ 2019-11-06  0:05 ` nobu
  2019-11-06  1:11 ` [ruby-core:95717] " mame
  2019-11-30 17:34 ` [ruby-core:96039] " eregontp
  3 siblings, 0 replies; 4+ messages in thread
From: nobu @ 2019-11-06  0:05 UTC (permalink / raw)
  To: ruby-core

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


It would be OK to remove `MatchData.allocate`, I think.
And `Regexp.allocate` too, but rubyspec has a couple of code using `Regexp.allocate`.

----------------------------------------
Feature #16294: Make MatchData frozen and forbid MatchData.allocate
https://bugs.ruby-lang.org/issues/16294#change-82498

* Author: Eregon (Benoit Daloze)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
Currently, `MatchData.allocate` is allowed, but almost every MatchData method called on it `raise TypeError, 'uninitialized Match'`.

I think MatchData should be frozen, none of its internal fields are mutable and I don't see any use case for storing instance variables on it.
Once frozen, we can implement MatchData#dup and #clone as just `return self`, and we don't need to check for the uninitialized case.
And Marshal can have special treatment to create an initialized MatchData directly.

My main motivation is looking at the code in TruffleRuby required to implement `MatchData.allocate` and check if it's initialized in so many places:
https://github.com/oracle/truffleruby/pull/1792/files

Thoughts? Anyone against?
cc @alanwu




-- 
https://bugs.ruby-lang.org/

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

* [ruby-core:95717] [Ruby master Feature#16294] Make MatchData frozen and forbid MatchData.allocate
       [not found] <redmine.issue-16294.20191105125925@ruby-lang.org>
  2019-11-05 12:59 ` [ruby-core:95699] [Ruby master Feature#16294] Make MatchData frozen and forbid MatchData#allocate eregontp
  2019-11-06  0:05 ` [ruby-core:95712] [Ruby master Feature#16294] Make MatchData frozen and forbid MatchData.allocate nobu
@ 2019-11-06  1:11 ` mame
  2019-11-30 17:34 ` [ruby-core:96039] " eregontp
  3 siblings, 0 replies; 4+ messages in thread
From: mame @ 2019-11-06  1:11 UTC (permalink / raw)
  To: ruby-core

Issue #16294 has been updated by mame (Yusuke Endoh).


I'm not against the proposal itself, but is it okay to introduce an incompatibility at this time?  cc: @naruse

----------------------------------------
Feature #16294: Make MatchData frozen and forbid MatchData.allocate
https://bugs.ruby-lang.org/issues/16294#change-82504

* Author: Eregon (Benoit Daloze)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
Currently, `MatchData.allocate` is allowed, but almost every MatchData method called on it `raise TypeError, 'uninitialized Match'`.

I think MatchData should be frozen, none of its internal fields are mutable and I don't see any use case for storing instance variables on it.
Once frozen, we can implement MatchData#dup and #clone as just `return self`, and we don't need to check for the uninitialized case.
And Marshal can have special treatment to create an initialized MatchData directly.

My main motivation is looking at the code in TruffleRuby required to implement `MatchData.allocate` and check if it's initialized in so many places:
https://github.com/oracle/truffleruby/pull/1792/files

Thoughts? Anyone against?
cc @alanwu




-- 
https://bugs.ruby-lang.org/

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

* [ruby-core:96039] [Ruby master Feature#16294] Make MatchData frozen and forbid MatchData.allocate
       [not found] <redmine.issue-16294.20191105125925@ruby-lang.org>
                   ` (2 preceding siblings ...)
  2019-11-06  1:11 ` [ruby-core:95717] " mame
@ 2019-11-30 17:34 ` eregontp
  3 siblings, 0 replies; 4+ messages in thread
From: eregontp @ 2019-11-30 17:34 UTC (permalink / raw)
  To: ruby-core

Issue #16294 has been updated by Eregon (Benoit Daloze).


@nobu Thanks for the change! I'll adapt the specs.

----------------------------------------
Feature #16294: Make MatchData frozen and forbid MatchData.allocate
https://bugs.ruby-lang.org/issues/16294#change-82889

* Author: Eregon (Benoit Daloze)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
Currently, `MatchData.allocate` is allowed, but almost every MatchData method called on it `raise TypeError, 'uninitialized Match'`.

I think MatchData should be frozen, none of its internal fields are mutable and I don't see any use case for storing instance variables on it.
Once frozen, we can implement MatchData#dup and #clone as just `return self`, and we don't need to check for the uninitialized case.
And Marshal can have special treatment to create an initialized MatchData directly.

My main motivation is looking at the code in TruffleRuby required to implement `MatchData.allocate` and check if it's initialized in so many places:
https://github.com/oracle/truffleruby/pull/1792/files

Thoughts? Anyone against?
cc @alanwu




-- 
https://bugs.ruby-lang.org/

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

end of thread, other threads:[~2019-11-30 17:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <redmine.issue-16294.20191105125925@ruby-lang.org>
2019-11-05 12:59 ` [ruby-core:95699] [Ruby master Feature#16294] Make MatchData frozen and forbid MatchData#allocate eregontp
2019-11-06  0:05 ` [ruby-core:95712] [Ruby master Feature#16294] Make MatchData frozen and forbid MatchData.allocate nobu
2019-11-06  1:11 ` [ruby-core:95717] " mame
2019-11-30 17:34 ` [ruby-core:96039] " eregontp

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).