logoalt Hacker News

ajayvk12/09/20242 repliesview on HN

I have been building an internal tools development and deployment platform [1]. It is built in Go, using Starlark for configuration and API business logic.

Starlark has been great to build with. You get the readability of having a simple subset of python, without python's dependency management challenges. It is easily extensible with plugin APIs. Concurrent API performance is great without the python async challenges.

One challenge wrt using Starlark as an general purpose embedded scripting language is that it does not support usual error handling features. There are no exceptions and no multi value return for error values, all errors result in an abort. This works for a config language, where a fail-fast behavior is good. But for a general purpose script, you need more fine grained error handling. Since I am using Starlark for API logic only, I came up with a user definable error handling behavior. This uses thread locals to keep track of error state [2], which might not work for more general purpose scripting use cases.

[1] https://github.com/claceio/clace

[2] https://clace.io/docs/plugins/overview/#automatic-error-hand...


Replies

numbsafari12/09/2024

Doing much the same thing. Face similar issues.

A lot of the complaints about Starlark as a programming language, and the proposed alternatives, seem to me to miss out on the UX advantages of having pythonic scripting (which so many folks who have taken a random "coding" class understand intuitively) whereas, e.g., using a lisp or lua would not. Further, having a language and runtime designed for safe use is absolutely critical, and trying to embed another runtime (js/wasm) and manage to lock it down successfully, is a much larger undertaking than I think folks realize.

show 1 reply
jcmfernandes12/09/2024

This is also one of my major complaints at this point. I'm building a developer tool with starklark resting at its core and I had already came across your work.

I wish the starklark team had addressed it at this point.

show 2 replies