This doesn’t make sense to me, since subscripts are just syntactic sugar; the subscript operator ought to support whatever a named function can support.

In this case I’m implementing a class that contains a JSON payload, and I want clients to be able to flexibly access properties of the JSON and assign them to values, with implicit type-casting, i.e.
var name: String = revision[“name”] // invoke subscript with T=String
var age: Int = revision[“age”] // invoke subscript with T=Int
(I got this idea from the Tailor library, although it doesn’t use subscripts, for reasons I now understand.)

This doesn’t make sense to me, since subscripts are just syntactic sugar;
the subscript operator ought to support whatever a named function can
support.

In this case I’m implementing a class that contains a JSON payload, and I
want clients to be able to flexibly access properties of the JSON and
assign them to values, with implicit type-casting, i.e.
var name: String = revision[“name”] // invoke subscript with
T=String
var age: Int = revision[“age”] // invoke subscript with
T=Int
(I got this idea from the Tailor library, although it doesn’t use
subscripts, for reasons I now understand.)