Skip to content

Conversation

@bkamins
Copy link
Member

@bkamins bkamins commented Dec 18, 2017

I suggest to define copy for Char. Otherwise operations like 'a'^1 throw an error.

Copy link
Member

@ararslan ararslan left a comment

Choose a reason for hiding this comment

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

Kind of a weird definition to have, but we have it for numbers, so ¯\_(ツ)_/¯

@bkamins
Copy link
Member Author

bkamins commented Dec 18, 2017

exactly, but some code assumes it.

@StefanKarpinski
Copy link
Member

Repeating characters works just fine:

julia> 'a'^1
"a"

I'm not against this but @JeffBezanson had some rather strong objections the last time copy methods for immutable types came up.

@bkamins
Copy link
Member Author

bkamins commented Dec 18, 2017

Sorry - I had Julia 0.7 before e596847 installed. Yes - now it works correctly 👍. So I am indifferent to this PR. On the other hand deepcopy works on Char now.

@ararslan
Copy link
Member

If 'a'^1 works now, I think I'd prefer we not do this. The fewer sketchy copy definitions the better, IMO.

@TotalVerb
Copy link
Contributor

Since strings are immutable too, and need not be copyed, I don't understand why this is needed. With numbers the argument can be made for compatibility with arrays.

@JeffBezanson
Copy link
Member

Adding this wouldn't be the end of the world, but since the original motivation no longer applies I'll close this for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants