If it's the former, I don't think we can do that.
Yeah, it's the former. Was hoping to be able to make a function that restricts you to only passing in protocol-type values/objects, but basically, looking for something like what @Nevin mentioned.
As for why this is something we'd want to do, well, it's kind of a long story... but basically we're using type metadata on generics to look up values for dependency injection. The types should always be protocols since the DI system is based on the idea of dependency inversion wehre everything depending on protocols (abstractions) and the implementations being hidden from the consumer.
Conversely it would also be nice to be able to use
where statements on generic types, like:
/// Does foo with bar
/// - Parameter bar: a value of some value type that:
/// - can't be an existential
/// - can't be an object
func foo<T>(bar: T) where T != Protocol && !(T: AnyObject)
This would enforce that you can only use a plain value type for some function where we want to make sure that no reference type semantics can creep into the code over time and we don't get the performance hit from existential containers.