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

Avoid polluting globals #203

Open
MartinMuzatko opened this issue Oct 31, 2019 · 2 comments
Open

Avoid polluting globals #203

MartinMuzatko opened this issue Oct 31, 2019 · 2 comments

Comments

@MartinMuzatko
Copy link

Hey there! I think for the sake of simplicity, you extend the prototype of Array. To communicate best practices, I'd like to come up with examples that do not extend the global Array object.

The alternative, to create objects from scratch is also more real-world oriented.

Here is a list of examples that use prototype

Thank you.

@jethrolarson
Copy link
Collaborator

While I agree, we'd have to either create our own List or some other type that implements all the relevant type classes. I have mixed feelings on whether that'd make it harder to understand

  • if we choose to create List is the reader gonna ask "Why are you reimplementing array in a feature-poor way?"
  • If we choose Maybe then it may be trying to teach too many ideas at once.
  • If we choose Identity then it becomes hard to justify as valuable and stay terse.

@jethrolarson
Copy link
Collaborator

Maybe defining everything in terms of static-land instead of fantasy-land would be better. https://github.com/fantasyland/static-land

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

2 participants