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

Are const object/arrays iterable? #27

Closed
robpalme opened this issue Jun 11, 2019 · 4 comments
Closed

Are const object/arrays iterable? #27

robpalme opened this issue Jun 11, 2019 · 4 comments

Comments

@robpalme
Copy link
Collaborator

#25 clarified enumeration order, but did not say whether const things are iterable.

Can I do:

let constObj = #{ a:1, b:2 };
for (let i of constObj) { console.log(i) }

let constArr = #[ 1, 2 ];
for (let i of constArr) { console.log(i) }
@rricard
Copy link
Member

rricard commented Jun 11, 2019

I would say no, you can iterate with Object.keys or Object.values but it should be clarified indeed

@rricard
Copy link
Member

rricard commented Jun 11, 2019

Arrays should be iterable

@rickbutton
Copy link
Member

agree, const objects not iterable, const arrays are

@rricard
Copy link
Member

rricard commented Jun 11, 2019

Basically, const variants should behave like the mutable variants when reading them but should be independent value types (see #24)

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