Skip to content

Implement generic Struct#clone#4178

Closed
Sija wants to merge 1 commit intocrystal-lang:masterfrom
Sija:add-default-struct-clone
Closed

Implement generic Struct#clone#4178
Sija wants to merge 1 commit intocrystal-lang:masterfrom
Sija:add-default-struct-clone

Conversation

@Sija
Copy link
Contributor

@Sija Sija commented Mar 23, 2017

Followup to PR #4174 adding Struct#clone (internally calling #dup).

@bcardiff
Copy link
Member

You don't wait :-)
clone should perform a deep copy

@Sija
Copy link
Contributor Author

Sija commented Mar 23, 2017

Sorry, too much ☕️ today turned my fast&furious mode ;) I was considering using def_clone, would that be sensible?

@Sija Sija force-pushed the add-default-struct-clone branch from 4afa161 to d7c42c7 Compare March 23, 2017 01:42
@Sija
Copy link
Contributor Author

Sija commented Mar 23, 2017

CI is failing because of a bug?

@asterite
Copy link
Member

Just in case, read this

It was previously decided that no generic clone method will be provided. That it was missing in Time (and probably in other types in the standard library) is not a good reason to provide a generic implementation for this. Cloning every member isn't always what you want, so forcing an implementation when needed is better.

@Sija
Copy link
Contributor Author

Sija commented Mar 23, 2017

@asterite I was thinking the same, Struct#clone sounded like a big generalization, that's why I started with #4174.

@bcardiff
Copy link
Member

Ok, my bad for suggesting a generic clone implementation for structs. Let's stay just with #4174.
I forgot about that conversation.

@bcardiff bcardiff closed this Mar 23, 2017
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.

3 participants