logoalt Hacker News

marssaxman12/09/20242 repliesview on HN

I'm curious - what about it strikes you that way?

To my eyes, starlark bears more resemblance to YAML, or TOML, or any other generic configuration language, than to Python.


Replies

laurentlb12/09/2024

You've probably looked only at the Bazel BUILD files. They are indeed quite declarative (as the syntax is restricted even more).

If you open other Starlark files that have functions (in Bazel, that would be in .bzl files), you should recognize the Python syntax (e.g. `def` statements + space indentation).

IshKebab12/09/2024

Erm what? It's very very obviously based on Python. The docs even explicitly say that. This is the example they give:

  def fizz_buzz(n):
    """Print Fizz Buzz numbers from 1 to n."""
    for i in range(1, n + 1):
      s = ""
      if i % 3 == 0:
        s += "Fizz"
      if i % 5 == 0:
        s += "Buzz"
      print(s if s else i)

  fizz_buzz(20)
Does that look like YAML or TOML?