Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upEditorial: iterator object != iterator record #1022
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ljharb
Oct 17, 2017
Member
I'd prefer the former, to avoid complicating the spec steps for Object.{keys,values,entries}.
|
I'd prefer the former, to avoid complicating the spec steps for |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
kmiller68
commented
Oct 17, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jmdyck
Oct 17, 2017
Collaborator
I'd prefer the former, to avoid complicating the spec steps for
Object.{keys,values,entries}.
I don't understand why changing EnumerateObjectProperties to return an iterator record would cause the spec steps for Object.{keys,values,entries} to change. They invoke EnumerableOwnProperties, which refers to EnumerateObjectProperties, but doesn't even invoke it, really. It seems like EnumerableOwnProperties could handle the change just by replacing the Iterator with the iterator record (in the Iterator that would be returned if the EnumerateObjectProperties internal method were invoked with _O_).
I don't understand why changing |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
kmiller68
Oct 17, 2017
I was thinking that it would be better to change ForIn/OfHeadEvaluation rather than EnumerableObjectProperties as changing EnumerableObjectProperties would mean that the example below needs to be changed. I'm mostly indifferent though.
kmiller68
commented
Oct 17, 2017
•
|
I was thinking that it would be better to change |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jmdyck
Oct 17, 2017
Collaborator
EnumerableOwnProperties doesn't have an example. I think you mean EnumerateObjectProperties.
|
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
kmiller68
Oct 17, 2017
Yeah, I copy pasted wrong the wrong word... That's what I get for commenting past my bed time... of 9pm.
kmiller68
commented
Oct 17, 2017
|
Yeah, I copy pasted wrong the wrong word... That's what I get for commenting past my bed time... of 9pm. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jmdyck
Oct 17, 2017
Collaborator
Okay, the sample code in EnumerateObjectProperties seems like a valid reason.
|
Okay, the sample code in |
jmdyck commentedOct 17, 2017
ForIn/OfHeadEvaluationinvokesEnumerateObjectPropertiesand returns its result.But
EnumerateObjectPropertiesreturns an iterator object andForIn/OfHeadEvaluationshould be returning an iterator record (since aa16347, see issue #988 from @kmiller68).So either:
ForIn/OfHeadEvaluationshould be altered to construct an iterator record from the iterator object thatEnumerateObjectPropertiesreturns, orEnumerateObjectPropertiesshould be altered to return an iterator record.(I think.)