bazel__book/starlark.md

15 lines
1,004 B
Markdown

# Starlark
[Official site](https://starlark-lang.org/)
## Differences with Python
| Feature | Python 3.x | Starlark |
|---------------------|----------------------------|------------------------------------------------|
| Classes | Supported | Not supported (use struct or provider) |
| While loops | Supported | Not supported (only for loops) |
| I/O | Full access (open, socket) | None (cannot read files or network) |
| Global Reassignment | Allowed | Illegal (globals are constants after init) |
| Recursion | Supported | Illegal |
| Strings | Iterable | Not iterable (use s.elems() or s.codepoints()) |
| Boolean Math | True + 1 == 2 | Error (Bools are not integers) |