Project

General

Profile

Actions

Misc #20222

closed

Dedup-ing clarification

Added by kddnewton (Kevin Newton) 4 months ago. Updated 3 months ago.

Status:
Closed
Assignee:
-
[ruby-core:116482]

Description

source = %q{"foo".freeze.equal?("foo".freeze)}

RubyVM::InstructionSequence.compile(source).eval # => true
RubyVM::InstructionSequence.compile_option = false
RubyVM::InstructionSequence.compile(source).eval # => false

"foo".freeze uses opt_str_freeze when optimizations are turned on, which also deduplicates. This means this code has different behavior depending on if optimizations are turned on or off.

To be clear, I'm not saying whether or not this is a problem. I'm asking if this is desired behavior?


Related issues 1 (0 open1 closed)

Related to Ruby master - Feature #8992: Use String#freeze and compiler tricks to replace "str"f suffixClosedmatz (Yukihiro Matsumoto)Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0