RejectedSoftware Forums

Sign up

bodyWriter type

I want to save to variable and transfer between objects output stream, returned by HTTPServerResponse.bodyWriter(). How to do it right?

Re: bodyWriter type

On Sun, 13 Aug 2017 01:31:13 GMT, Alexey Kulentsov wrote:

I want to save to variable and transfer between objects output stream, returned by HTTPServerResponse.bodyWriter(). How to do it right?

Since it could very well happen that the type changes in the future and the current InterfaceProxy!T is not yet officially publicly available, I'd recommend to use an alias to typeof(HTTPServerResponse.bodyWriter) as the variable type.

When passing it to functions, the best approach would be to use void writeSomething(OS)(OS body_writer) if (isOutputStream!OS) { ... }, but of course using the alias above is also fine.

Re: bodyWriter type

On Sun, 13 Aug 2017 18:49:39 GMT, Sönke Ludwig wrote:

On Sun, 13 Aug 2017 01:31:13 GMT, Alexey Kulentsov wrote:

I want to save to variable and transfer between objects output stream, returned by HTTPServerResponse.bodyWriter(). How to do it right?

Since it could very well happen that the type changes in the future and the current InterfaceProxy!T is not yet officially publicly available, I'd recommend to use an alias to typeof(HTTPServerResponse.bodyWriter) as the variable type.

When passing it to functions, the best approach would be to use void writeSomething(OS)(OS body_writer) if (isOutputStream!OS) { ... }, but of course using the alias above is also fine.

Thanks! Now I understand that my question was poorly worded, but you answered exactly what I wanted to ask: how to deal with InterfaceProxy.