From 1082399dff99e1ac6b4b583ed5b81889bd1c0e56 Mon Sep 17 00:00:00 2001 From: Matt Wolenetz Date: Tue, 20 Dec 2022 12:00:47 -0800 Subject: [PATCH] Fix #400 by explicitly warning against exception-throwing getters --- index.bs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/index.bs b/index.bs index de76eeb6..f04d35d0 100644 --- a/index.bs +++ b/index.bs @@ -1359,6 +1359,13 @@ whether to use an attribute or a method. - Attribute getters must not have any (observable) side effects. If you have expected side effects, use a method. +- Attribute getters should not throw exceptions. + Exceptions are side effects. + Updating existing APIs to include getters that throw exception must be avoided. + +Note: For example, existing API users may enumerate or wrap the API and not expect +the new exception, breaking backwards compatibility of the API change. + - Attribute getters should not perform any blocking operations. If a getter requires performing a blocking operation, it should be a method.