Confused about checks on assignments in collections. #36
Replies: 5 comments 3 replies
This comment has been hidden.
This comment has been hidden.
-
@happy-barney, is this the kind of issue you were talking about re: performance here? That the values (rather than just the variables) should have some idea of what checks they pass? |
Beta Was this translation helpful? Give feedback.
-
@matthewpersico Sorry, that section of the spec needs to be reworded.
It's not "all elements", it's only the elements being changed. |
Beta Was this translation helpful? Give feedback.
-
@matthewpersico Also, the spec is now at the wiki where it can be updated. I'll make the change for this. That gist is now there for historical reasons. |
Beta Was this translation helpful? Give feedback.
-
Are we good? Can I close this discussion now, or is there more work needed here? |
Beta Was this translation helpful? Give feedback.
-
At Applying a check to an array variable, it is stated (emphasis mine):
If a check is specified on an array, that check is applied to each element of the array, every time any element is modified in any way (assigned to, concatenated to, incremented, deleted, etc.)
At Applying a check to a hash variable, it is stated (emphasis mine):
If a check is specified on a hash, that check is applied to the value of each entry in the hash, [only (sic)] whenever those values are assigned.
I am confused. Why would you check all ten elements of an array if you are only assigning specific ones, yet check only the newly assigned elements in a hash? Am I reading the statements incorrectly? That array handling seems to be an awful bottleneck if I am going to recheck every element on each
push
, for example.Beta Was this translation helpful? Give feedback.
All reactions