Skip to content

Commit

Permalink
fewer words, easier reading
Browse files Browse the repository at this point in the history
Incorporating feedback from [PR 9310](#9310).

Closes #9326.

PiperOrigin-RevId: 267268785
  • Loading branch information
gnarled-cipher authored and copybara-github committed Sep 5, 2019
1 parent e29ddda commit 97a8264
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions site/docs/skylark/language.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def fizz_buzz(n):
fizz_buzz(20)
```

Starlark's semantics can differ from Python, and behavioral differences are
Starlark's semantics can differ from Python, but behavioral differences are
rare, except for cases where Starlark raises an error. The following Python
types are supported:

Expand Down Expand Up @@ -72,7 +72,7 @@ context. When `fct()` runs, it does so within the context of `foo.bzl`. After
evaluation for `foo.bzl` completes, the environment contains an immutable entry,
`var`, with the value `[5]`.

When another, `bar.bzl` loads symbols from `foo.bzl`, loaded values remain
When another `bar.bzl` loads symbols from `foo.bzl`, loaded values remain
immutable. For this reason, the following code in `bar.bzl` is illegal:

```python
Expand All @@ -84,8 +84,9 @@ var.append(6) # runtime error, the list stored in var is frozen
fct() # runtime error, fct() attempts to modify a frozen list
```

Just like the above example using `bzl` files, values returned by rules are
immutable too.
Global variables defined in `bzl` files cannot be changed outside of the
`bzl` file that defined them. Just like the above example using `bzl` files,
values returned by rules are immutable.

## Differences between BUILD and .bzl files

Expand Down Expand Up @@ -128,9 +129,8 @@ not defined across value types. In short: `5 < 'foo'` will throw an error and
* Dictionary literals cannot have duplicated keys. For example, this is an
error: `{"a": 4, "b": 7, "a": 1}`.

* The variable used in a comprehension may not be used after the comprehension.
This is stricter than Python 2 and Python 3, which have different behavior
(shadowing vs reassignment).
* The identifier used in a comprehension may not be used after the comprehension.
This is stricter than Python 2 and Python 3.

* Strings are represented with double-quotes (e.g. when you call
[repr](lib/globals.html#repr)).
Expand Down

0 comments on commit 97a8264

Please sign in to comment.