I get the familiar “Consecutive declarations on a line must be separated by ‘;’” error at the “throws” keyword.
Is this an intentional design limitation, or just a compiler bug?
In my case, the subscript operator is looking up a value from a database given its key, so there are various ways it could fail aside from there not being a value.
We haven’t discussed allowing subscripts and computed properties to be throwable yet, but I don’t see any obvious reason to to support them. That said, supporting this would introduce some complexity into the model: We’d have to decide whether the getter and setter could have different throws markers. While being able to express that would be great, allowing that would actually be quite hard and surprising for our model. We’d have to support protocol requirements, overload, etc.
In any case, we need to talk about this, we’ll do so over the next few weeks.