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

Swift "naive" impl contradicts the philosophy #78

Open
rex-remind101 opened this issue Sep 23, 2019 · 2 comments
Open

Swift "naive" impl contradicts the philosophy #78

rex-remind101 opened this issue Sep 23, 2019 · 2 comments

Comments

@rex-remind101
Copy link

The README states

We define the "naive" implementations as those which a developer with enough experience in a given language would implement as a baseline "good enough" solution where correctness is more important than performance.

Yet the Swift Language Guide, which relatively speaking a developer with any experience will spend some time glancing at clearly states:

The additional capabilities that classes support come at the cost of increased complexity. As a general guideline, prefer structures because they’re easier to reason about, and use classes when they’re appropriate or necessary. In practice, this means most of the custom data types you define will be structures and enumerations.

https://docs.swift.org/swift-book/LanguageGuide/ClassesAndStructures.html

Yet the impl uses classes exclusively contradicting the above two notions

@frol
Copy link
Owner

frol commented Sep 24, 2019

@rex-remind101 good catch! May I ask you to submit a PR?

@Cyberbeni
Copy link

Nodes need to be moved a lot, so I wouldn't use a struct for it. Also it doesn't build if you try to use a struct:

error: value type 'Node' cannot have a stored property that recursively contains it

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