Skip to content

Commit

Permalink
Mention that lists can be stored in sets after freezing
Browse files Browse the repository at this point in the history
--
MOS_MIGRATED_REVID=135472917
  • Loading branch information
brandjon authored and katre committed Oct 7, 2016
1 parent 33579a4 commit f95fa87
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion site/versions/master/docs/skylark/concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ In a build, there are many "evaluation contexts": each `.bzl` file and each
`BUILD` file is loaded in a different context. Each rule is also analyzed in a
separate context. We allow side-effects (e.g. appending a value to a list or
deleting an entry in a dictionary) only on objects created during the current
evaluation context.
evaluation context. Once the code in that context is done executing, all of its
values are frozen.

For example, here is the content of the file `foo.bzl`:

Expand Down Expand Up @@ -161,6 +162,9 @@ Python:

* Sets have reference equality semantics and can be stored in other sets.

* Lists and other mutable values may be stored in sets and in dictionary
keys once they are frozen.

* Modifying a collection during iteration is an error. You can avoid the error
by iterating over a copy of the collection, e.g.
`for x in list(my_list): ...`. You can still modify its deep contents
Expand Down

0 comments on commit f95fa87

Please sign in to comment.