The existing specification for OWIN makes it difficult to leverage immutable data structures for the required IDictionary<string, object> environment and IDictionary<string, string[]> headers dictionaries. While it's unlikely that we will ever move away from Stream, a simple spec change would allow those of us who want immutable IDictionary types to do so: type AppFunc = Func<IDictionary<string, object>, Task<IDictionary<string, object>>>.
This signature could be used by existing implementations rather easily by simply returning the environment dictionary instance. However, for those using immutable data structures, this signature allows such implementations to return the new instance as it is passed along through the middleware chain or modified by the running application.
No changes would be required for the other existing or proposed signatures, which already return instances of one thing or another.
The existing specification for OWIN makes it difficult to leverage immutable data structures for the required
IDictionary<string, object>environment andIDictionary<string, string[]>headers dictionaries. While it's unlikely that we will ever move away fromStream, a simple spec change would allow those of us who want immutableIDictionarytypes to do so:type AppFunc = Func<IDictionary<string, object>, Task<IDictionary<string, object>>>.This signature could be used by existing implementations rather easily by simply returning the environment dictionary instance. However, for those using immutable data structures, this signature allows such implementations to return the new instance as it is passed along through the middleware chain or modified by the running application.
No changes would be required for the other existing or proposed signatures, which already return instances of one thing or another.