Open trevorade opened 7 years ago
+cc @fweikert @laurentlb @dslomov @damienmg
This is probably something we want to address in Stardoc.
Instead of {List of String}
I'd be much happier to see the typing syntax used for python: https://www.python.org/dev/peps/pep-0484/ . So that's be written as {List[str]}
(assuming you still need the curly braces to tell what's a type specification)
PEP 484 looks like the best choice, indeed.
at a higher level - I would love if starlark itself adopted mypy-like typechecking. I've often struggled with getting the shape of providers right, and felt that static typing would better attribute the mistakes to where they are made in code when the types start getting complicated.
@dgoldstein0 See https://github.com/bazelbuild/starlark/issues/106. But I don't see types remotely near the top of our priorities for the next 12 months.
Currently, with the exception of optional arguments and those named
name
ordeps
and perhaps a few more, all the types for Skylark macro arguments areUnknown
.I propose that skydoc support specifying argument types for macros using a {CurlyBrace} syntax. Here's an example:
Presumably, you'd have a handful of supported types as indicated by: https://bazel.build/versions/master/docs/skylark/lib/skylark-builtin.html