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

Array().length == 1? #18

Open
arj03 opened this issue Oct 28, 2017 · 2 comments
Open

Array().length == 1? #18

arj03 opened this issue Oct 28, 2017 · 2 comments

Comments

@arj03
Copy link
Contributor

arj03 commented Oct 28, 2017

It seems that

let a = Array()
console.log(a.length)

= 1, but:

let a2 = []
console.log(a2.length)

= 0

This is a bit of a gotcha :)

@mmckegg
Copy link
Owner

mmckegg commented Oct 28, 2017

Indeed. This is one of the many unfortunate consequences of using function as the base for all the observables.

Here is an idea to improve the situation by making only the simple types based on function and moving the complex (collections, structs, etc) to ordinary objects: #8 (comment)

We’d also change isObservable to use Symbols for detection instead of typeof x === ‘function’.

@arj03
Copy link
Contributor Author

arj03 commented Oct 30, 2017

Great! I'm all for removing gotcha's. This is very much related to the documentation part of scuttlebot. While developing something for patchcore I changed my tactics to highlightning pain points I find as I move through them, hopefully we can all learn something :)

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