In an interface declaration, when is it OK to omit the return type of a required function? Should a generic return type be regulated by the same rules as an omitted return type?
For example:
interface IFC {
// omitted return type
proc fun1(...); // ok? the return type is implicitly void?
proc fun2(...) // ok? the return type is implicitly void or inferred from the body?
{ ... default implementation ... }
// generic return type
proc fun3(...): MyGenericRecord; // ok?
proc fun4(...): MyGenericRecord // ok? the concrete return type is inferred from the body?
{ ... default implementation ... }
}
The current answers to the above, implemented in #17213, are:
fun1 is OK, the return type is assumed to be void
fun2 is OK, assuming void return type and provided that the body conforms to it
fun3, fun4 - ?
We may want to impose stricter rules for the return types, ex.:
even void must be specified explicitly
the specified return type must be concrete
OK if it is a generic type instantiated with interface arguments and/or associated types and/or non-interface types
I would be okay with permitting generic return types for interface functions, but it would be okay with me to start by disallowing it until we're more confident in the implementation or until requested.
Main issue: #8629
In an interface declaration, when is it OK to omit the return type of a required function? Should a generic return type be regulated by the same rules as an omitted return type?
For example:
The current answers to the above, implemented in #17213, are:
void
void
return type and provided that the body conforms to itWe may want to impose stricter rules for the return types, ex.:
void
must be specified explicitly