Skip to content

Conversation

@casperisfine
Copy link

Ref: ruby/ruby#10235

As discussed upstream, the mutability is only used in one spec, path.rb:

 @name = +"file_to_path" @path = tmp(@name)

For all the others it doesn't matter if the argument is mutated or not.

cc @eregon

Ref: ruby/ruby#10235 As discussed upstream, the mutability is only used in one spec, `path.rb`: ```ruby @name = +"file_to_path" @path = tmp(@name) ``` For all the others it doesn't matter if the argument is mutated or not.
if uniquify and !name.empty?
slash = name.rindex "/"
index = slash ? slash + 1 : 0
name = +name
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think .dup might be nicer here, because then this method simply never mutates the argument, which feels cleaner, could you switch to that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see + is more compatible and in fact current ruby/spec passes with this change.
Let's merge as-is then and maybe clean this up later.

@eregon eregon merged commit b8f8f4e into ruby:master Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants