Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tmp: accept frozen strings #69

Merged
merged 1 commit into from
Mar 13, 2024
Merged

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.
@@ -41,6 +41,7 @@ def tmp(name, uniquify = true)
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
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants