<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 29, 2013 at 6:14 AM, Anthony Grimes <span dir="ltr"><<a href="mailto:i@raynes.me" target="_blank">i@raynes.me</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:start;font-style:normal;display:inline!important;font-weight:normal;float:none;line-height:normal;color:rgb(34,34,34);text-transform:none;font-size:13px;white-space:normal;font-family:arial,sans-serif;word-spacing:0px">So I'm wondering if people are aware of this problem, and 
I'd like to</span><br style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:start;font-style:normal;font-weight:normal;line-height:normal;color:rgb(34,34,34);text-transform:none;font-size:13px;white-space:normal;font-family:arial,sans-serif;word-spacing:0px">

<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:start;font-style:normal;display:inline!important;font-weight:normal;float:none;line-height:normal;color:rgb(34,34,34);text-transform:none;font-size:13px;white-space:normal;font-family:arial,sans-serif;word-spacing:0px">make sure that people think it is an actual problem that 
should be</span><br style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:start;font-style:normal;font-weight:normal;line-height:normal;color:rgb(34,34,34);text-transform:none;font-size:13px;white-space:normal;font-family:arial,sans-serif;word-spacing:0px">

<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:start;font-style:normal;display:inline!important;font-weight:normal;float:none;line-height:normal;color:rgb(34,34,34);text-transform:none;font-size:13px;white-space:normal;font-family:arial,sans-serif;word-spacing:0px">fixed. I'm also curious what people think a good solution 
to the problem</span><br style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:start;font-style:normal;font-weight:normal;line-height:normal;color:rgb(34,34,34);text-transform:none;font-size:13px;white-space:normal;font-family:arial,sans-serif;word-spacing:0px">

<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:start;font-style:normal;display:inline!important;font-weight:normal;float:none;line-height:normal;color:rgb(34,34,34);text-transform:none;font-size:13px;white-space:normal;font-family:arial,sans-serif;word-spacing:0px">would be. I'm not sure I have 
the time/particular skill set to fix it</span><br><span>given that the port code is some pretty obscure (to me) C code, 
but</span><br style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:start;font-style:normal;font-weight:normal;line-height:normal;color:rgb(34,34,34);text-transform:none;font-size:13px;white-space:normal;font-family:arial,sans-serif;word-spacing:0px">

<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:start;font-style:normal;display:inline!important;font-weight:normal;float:none;line-height:normal;color:rgb(34,34,34);text-transform:none;font-size:13px;white-space:normal;font-family:arial,sans-serif;word-spacing:0px">starting conversation seems like a good way to begin.</span>
</blockquote></div><br>I don't think ports were created with that use case in mind. Usually when connecting Erlang to foreign programs, you have the advantage of being able to specify the interface fully and then you can pick a better protocol than "send message and then EOF". The deeper trouble here is that such an interface means it is use-once. It will just blindly fork()/exec() programs all the time and that hardly seems productive and efficient. It probably will not scale very well and then you are looking at a framing solution on the stream in any case.</div>

<div class="gmail_extra"><br></div><div class="gmail_extra">Note the same problem is present with gen_tcp:shutdown/2. It seems counterproductive to pay the handshake every time you want to communicate.</div><div class="gmail_extra">

<br></div><div class="gmail_extra">Another problem is that with a fork()/exec() solution you ctx switch to the pygmentize process (or whatever process) for one processing only and then you switch away again. You can't pipeline stuff to pygmentize and hence you pay ctx switch overhead all the time.</div>

<div class="gmail_extra"><br></div><div class="gmail_extra">In other words, I have a hard time seeing this to be useful, but you may correct me on that if you have a better use case or can shoot down my stream of thought.</div>

</div>