
21 Oct
2016
21 Oct
'16
9:14 p.m.
I feel like if you can figure out what you actually want Accept to do, it will become clearer. Here's my attempt. Accept takes a chan, takes a procedure to loop on, a procedure to accept on, and then returns the server chan to continue the loop. I don't know if this is entirely right, but it type checks and hopefully it will give you some ideas.
As you've said Accept needs refinement. I tried writing a interpretUDP which doesn't have an accept loop but does have a bind + listen. I suspect that accept needs to move into the interpretTCP somehow and the DSL needs to be Bind or similar. Bind makes more sense as well if I wanted to write a pipes or a chan based interpreter. Thanks for the rewrite and the pointers. -Sumit