Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That's kind of what Bazel does. Skylark is a Python dialect.


Why is an entirely new dialect necessary? Why couldn't it just have been a python library?


It started as that at Google and was a nightmare in the long run. People would sneak in dependencies on non-hermetic or non-reproducible behavior all the time. The classic "this just needs to work, screw it I'm pulling in this library to make it happen" problem. It just kept getting more and more complex to detect and stop those kinds of issues. Hence a new language with no ability to skirt around its hermetic and non-turing nature.


Mozilla uses Python, but executes the code in a very limited environment so you can't import anything not on an allowlist, can't write to files, etc. But it's just the regular Python interpreter executing stuff. It produces a set of data structures describing everything that are then used by the unrestricted calling Python code.

It seems to work pretty well, though it feels a little constraining when I'm trying to figure something out and I can't do the standard `import pdb; pdb.set_trace()` thing. There's probably a way around that, but I've never bothered to figure it out.


Starlark is an extremely limited dialect of Python. It is intentionally not Turing complete, to prevent unbounded computation.

I think the rationale for making it syntactically similar to Python was: we want to add a macro processing language to our build system, and we want to support common features like integers, strings, arithmetic expressions, if-statements, for-loops, lists, tuples and dictionaries, so why not base our DSL off of Python that has all that stuff, so that people familiar with Python will have an easy time reading and writing it?

Then they implemented a very limited but very fast interpreter that supports just the non-Turing-complete DSL.


To limit what can be done, to make it easier to reason about: https://docs.bazel.build/versions/master/skylark/language.ht...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: