You can edit almost every page by Creating an account and confirming your email.

Starlark

From EverybodyWiki Bios & Wiki



Starlark
Paradigmscripting, procedural (imperative)[1]
First appeared2015; 11 years ago (2015)[2]
Typing disciplineDynamic[1]
OSCross-platform
Filename extensions.star
Websitegithub.com/bazelbuild/starlark/
Major implementations
starlark-go, starlark-rust,
Influenced by
Python[1]

Search Starlark on Amazon.

Starlark is a lightweight, high-level programming language designed for embedded use in applications. It uses a subset of the Python syntax. By default, the code is deterministic and hermetic.[1]

History

Starlark was released in 2015 as part of Bazel under the name Skylark[3]. This first implementation was written in Java. In 2018, the language was renamed Starlark.[4]

In 2017, a new implementation of Starlark in Go was announced.[5]

In 2021, Meta announced an implementation of Starlark written in Rust,[6] to be used for the Buck build system.[7][8]

Popularity

In addition to the Bazel[9] and Buck build systems, Starlark is used by dozens of projects,[10][11] including Isopod[12], skycfg[13], and Tilt.[14]

On GitHub, Starlark is among the top 50 languages based on the developer activity.[15][16]

Syntax

Starlark syntax is a strict subset of Python syntax.[1] Similar to Python syntax, Starlark relies on indentation to delimit blocks, using the off-side rule.

Statements and control flow

Starlark's statements include:[17]

  • The = statement to assign a value to a variable
  • The augmented assignment statements to modify a variable
  • The if statement to execute conditionally a block of code (with else or elif)
  • The for statement to iterate over an iterable object
  • The def statement to define a function
  • The break statement to exit a loop
  • The continue statement to skip the rest of the current iteration and continues with the next
  • The pass statement, serving as a NOP, syntactically needed to create an empty code block
  • The return statement to return a value from a function.
  • The load statement, which replaces Python import, to import a value from another module.[18] Unlike Python, the order of load statements does not affect the semantics of the code.[19]

Unlike Python, Starlark statements don't include: while, try, raise, class, with, del, assert, yield, import, match and case.[20]

Freezing

To ensure thread safety and support parallel computing, Starlark has a feature called freezing. At the end of the evaluation of a module, all values become immutable. This means that the values that can be accessed from multiple threads can no longer be modified, which removes the risk of race conditions.[3][21]

See also

  • Python

References

  1. ↑ 1.0 1.1 1.2 1.3 1.4 "starlark/spec.md at master · bazelbuild/starlark". GitHub.
  2. ↑ Le Brun, Laurent. "An Overview of the Starlark language". Retrieved 1 September 2025.
  3. ↑ 3.0 3.1 "A glimpse of the design of Skylark". blog.bazel.build.
  4. ↑ "Starlark". blog.bazel.build.
  5. ↑ Donovan, Alan (18 November 2017). A Go implementation of the Skylark Configuration Language. GothamGo 2017 – via YouTube.
  6. ↑ Mitchell, Neil (2021-04-08). "The Rust Starlark library".
  7. ↑ "Meta open-sources 'significantly faster' build system". InfoWorld.
  8. ↑ "5 Things you didn't know about Buck2". 23 October 2023.
  9. ↑ Antoniucci, Javier (2024). Ultimate Monorepo and Bazel for Building Apps at Scale: Level up Your Large-Scale Application Development with Monorepo and Bazel for Enhanced Productivity, Scalability, and Integration (English Edition) (1st ed.). Orange Education PVT Ltd. ISBN 9788197223914. Search this book on
  10. ↑ "Starlark Programming Language". starlark-lang.org.
  11. ↑ Pandey, Mohit (12 December 2024). "Starlark is Basically Python, But Not Really Python, and That's Fine". AIM. Retrieved 13 December 2024.
  12. ↑ Xu, Charles; Ilyevskiy, Dmitry (2019). Isopod: An expressive DSL for Kubernetes configuration. Proceedings of the ACM Symposium on Cloud Computing. doi:10.1145/3357223.3365759.
  13. ↑ Norton, Peter (2019). "Other Faces of Python" (PDF). Login Usenix Mag. 44 (2).
  14. ↑ Sayfan, Gigi (2019). Hands-on microservices with Kubernetes: build, deploy, and manage scalable microservices on Kubernetes (1st ed.). Packt Publishing. p. 353. ISBN 9781789809732. Search this book on
  15. ↑ "Global Metrics: Programming Languages". Innovation Graph. GitHub.
  16. ↑ "Languish - Programming Language Trends".
  17. ↑ "starlark/spec.md at master · bazelbuild/starlark". GitHub.
  18. ↑ "starlark/spec.md at master · bazelbuild/starlark". GitHub.
  19. ↑ Le Brun, Laurent (December 2024). "A practical introduction to the Starlark language". Retrieved 24 March 2025.
  20. ↑ "starlark/spec.md at master · bazelbuild/starlark". GitHub.
  21. ↑ "starlark/spec.md at master · bazelbuild/starlark". GitHub.


This article "Starlark" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:Starlark. Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.