Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Starlark

From Wikipedia, the free encyclopedia
Lightweight programming language

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

Starlark is alightweight,high-levelprogramming language designed forembedded use in applications. It uses a subset of thePython syntax. By default, the code isdeterministic and hermetic.[1]

History

[edit]

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

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

In 2021,Meta announced an implementation of Starlark written inRust,[6] to be used for theBuckbuild system.[7][8]

Popularity

[edit]

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

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

Syntax

[edit]

Starlarksyntax is a strict subset ofPython syntax.[1] Similar toPython syntax, Starlark relies on indentation to delimit blocks, using theoff-side rule.

Statements and control flow

[edit]

Starlark'sstatements include:[18]

  • The= statement toassign a value to a variable
  • Theaugmented assignment statements to modify a variable
  • Theif statement to execute conditionally a block of code (withelse orelif)
  • Thefor statement to iterate over aniterable object
  • Thedef statement to define afunction
  • Thebreak statement to exit a loop
  • Thecontinue statement to skip the rest of the current iteration and continues with the next
  • Thepass statement, serving as aNOP, syntactically needed to create an empty code block
  • Thereturn statement to return a value from a function.
  • Theload statement, which replaces Pythonimport, to import a value from anothermodule.[19] Unlike Python, the order of load statements does not affect the semantics of the code.[20]

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

Freezing

[edit]

To ensurethread safety and supportparallel computing, Starlark has a feature calledfreezing. At the end of the evaluation of a module, all values becomeimmutable. This means that the values that can be accessed from multiplethreads can no longer be modified, which removes the risk ofrace conditions.[3][22]

See also

[edit]

References

[edit]
  1. ^abcde"starlark/spec.md at master · bazelbuild/starlark".GitHub.
  2. ^Le Brun, Laurent (January 2024)."An Overview of the Starlark language". Retrieved1 September 2025.
  3. ^ab"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 (8 April 2021)."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.
  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. Retrieved13 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. ^"Open-Sourcing Starlark Worker: Define Cadence Workflows with Starlark".uber.com.
  15. ^Sayfan, Gigi (2019).Hands-on microservices with Kubernetes: build, deploy, and manage scalable microservices on Kubernetes (1st ed.). Packt Publishing. p. 353.ISBN 9781789809732.
  16. ^"Global Metrics: Programming Languages".Innovation Graph. GitHub.
  17. ^"Languish - Programming Language Trends".
  18. ^"starlark/spec.md at master · bazelbuild/starlark".GitHub.
  19. ^"starlark/spec.md at master · bazelbuild/starlark".GitHub.
  20. ^Le Brun, Laurent (December 2024)."A practical introduction to the Starlark language". Retrieved24 March 2025.
  21. ^"starlark/spec.md at master · bazelbuild/starlark".GitHub.
  22. ^"starlark/spec.md at master · bazelbuild/starlark".GitHub.
Retrieved from "https://en.wikipedia.org/w/index.php?title=Starlark&oldid=1322862129"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp