Project

General

Profile

Actions

Feature #17256

closed

Freeze all Regexp objects

Added by ko1 (Koichi Sasada) over 3 years ago. Updated over 3 years ago.

Status:
Closed
Target version:
-
[ruby-core:100345]

Description

To be shared between ractors, Regexp objects should be frozen.

Now, Matz has proposed to make all Regexp objects frozen.

Ten months ago, there was a note https://bugs.ruby-lang.org/issues/16377#note-7 :

For the record: Regexp.new should continue to return unfrozen Regexp instance.

So I'm not sure whether it is a good way or not.

Could you give me your comment on it?

If no comments are given, I'll try to freeze them before Ruby 3.0 preview 2.

BTW, I believe /#{expr}/o should be frozen because this expression only returns one Regexp object.


Related issues 2 (1 open1 closed)

Related to Ruby master - Misc #17412: Regexp vs Range: freezing differencesClosedActions
Related to Ruby master - Feature #8948: Frozen regexAssignedEregon (Benoit Daloze)Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0