docs: "BXL APIs" doesn't say that it means the *global object* bxl inside a bxl file
https://buck2.build/docs/api/bxl/
It is unclear from immediately looking at this that it is saying that bxl is a magic global in bxl context.
Also, main is unclear: there's bxl_main which is clearly used, but I don't know whether this main does anything special.
It looks like bxl_main and main are identical, but bxl_main is used in the BXL Tutorial and undocumented in the BXL APIs, and main is not used in the tutorial but is documented in the BXL APIs.
yes, bxl_main and bxl.main are the same, they even share the implementation:
https://github.com/facebook/buck2/blob/b29b66356ae7fce89845ec8865c65263ab1f9eec/app/buck2_bxl/src/bxl/starlark_defs/bxl_function.rs#L52-L117
As @PhilipMetzger said, these two are identical.
We have a plan to make everything that specific to bxl under bxl namespace, i.e bxl.main for this case. But we haven't started to migrate.