user-documentation
user-documentation copied to clipboard
Suggestion on introducing capability hierarchies in example
Where is the problem?
In https://docs.hhvm.com/hack/contexts-and-capabilities/introduction#parameterized-contexts
What is the problem?
Instead of:
function throws_foo_or_bar_exception(bool $cond)[
throws<FooException>, throws<BarException> // {Throws<FooException>, Throws<BarException>}
]: void {
Let's showcase:
function throws_foo_or_bar_exception(bool $cond)[
throws<Exception> // {Throws<Exception>}
]: void {
- Build ID: HHVM=HHVM-4.87.0:HSL=v4.41.0:2021-01-06T00:32:37+0000:1fa47f258c6b68f8ec01899aa82fd6ffa0957109
- Page requested: /hack/contexts-and-capabilities/introduction
- Page requested at: Fri, 08 Jan 2021 18:56:50 +0000
- Controller: GuidePageController
@DavidSnider is probably the best person to decide if this makes sense, right now hierarchies are introduced fairly late (5th page) which is probably intentional?
I don't see any examples of context subtyping for parametrized contexts though, that could be a good thing to add somewhere (not necessarily the introduction). Our current subtyping examples is ReadFile <: Rand which is not as intuitive.