> > Now, it's very uncommon that you would create a stream and then pipe > **to** it some number of cycles later. But, over time I think that people > will be used to the "magic" of these new streams that can be created and > piped around whenever and will step on this. > > It is not so uncommon. A number of people got the problem with the following scenario:
1) http server dispatches POST request 2) request is authenticated 3) request is routed 4) POSTed data is piped to destination. The problem is that step 2 (authentication) usually needs to access some kind of database. So, the stream (request) is created at step 1 and piped at step 4, with I/O ticks at step 2. You cannot assume that you'll always have all the elements to decide what to do with a stream in the tick that creates the stream. Some time you need to read some header data from the stream, do some I/O to gather related data that will tell you what to do with the stream, and then only process the stream (pipe it).