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

Card type could be a class rather than a struct #37

Open
shawnrc opened this issue Mar 10, 2018 · 2 comments
Open

Card type could be a class rather than a struct #37

shawnrc opened this issue Mar 10, 2018 · 2 comments

Comments

@shawnrc
Copy link

shawnrc commented Mar 10, 2018

Cards are entirely immutable as is, and with like 13,000+ of them potentially in use, it doesn't really make sense to copy them around as much as they're currently forced to be. Consider making Card a class.

@naknut
Copy link
Contributor

naknut commented Jul 2, 2019

I dont think it should be a class. Swift best practice is to keep data as structs as long as you dont have a reason to use a reference type (like when you want to be able to modify a existing piece of data). And also, value types aren't always copied. The standard library tries to use copy-on-write for value types when able to, so chances are there are not actually any copies made if you just pass them around, specially for immutable data.

I dont think we should use classes unless we can see some weird performance issues related to using value types.

@Lemonbrush
Copy link

Totally agree

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

No branches or pull requests

3 participants