[#115884] Windows Ruby 3.2.2: Non-English character added to Windows Registry String Value — Jay Mav via ruby-core <ruby-core@...>
Hello,
3 messages
2023/12/24
[ruby-core:115564] [Ruby master Bug#20033] `/#{''}(?<lvar>)/ =~ s` looks like a dynamic regexp match but assigns to local variable
From:
"Eregon (Benoit Daloze) via ruby-core" <ruby-core@...>
Date:
2023-12-01 13:38:52 UTC
List:
ruby-core #115564
Issue #20033 has been updated by Eregon (Benoit Daloze).
+1, it should only be static regexp literals which assign variables (= without `#{}`), that's much simpler for everyone to understand.
The current situation feels like mixing parsing and compilation/optimization in the parser.
----------------------------------------
Bug #20033: `/#{''}(?<lvar>)/ =~ s` looks like a dynamic regexp match but assigns to local variable
https://bugs.ruby-lang.org/issues/20033#change-105498
* Author: tompng (tomoya ishida)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.3.0dev (2023-11-30T16:23:25Z master d048bae96b) [x86_64-linux]
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN
----------------------------------------
I expect all of these code not to assign to lvar because all regexp looks like embedded dynamic regexp.
~~~ruby
/#{''}(?<lvar>)/ =~ '' # assings to lvar
/#{"#{''}"}(?<lvar>)/ =~ '' # does not assign to lvar
/#{<<A}(?<lvar>)/ =~ '' # assigns to lvar
string
A
/#{<<A}(?<lvar>)/ =~ '' # does not assign to lvar
#{'string'}
A
~~~
I think `/#{'a'}/` can be a DREGX because for string, `"#{'a'}#{'b'}"` is DSTR `(DSTR@1:0-1:14 "ab" nil nil)`.
--
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/