<div class="gmail_quote">On 16 January 2012 18:37, Tim Fletcher <span dir="ltr"><<a href="mailto:mail@tfletcher.com">mail@tfletcher.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">> Also, accessors return the state because Cowboy doesn't try to parse or<br>
> read anything from the socket if it doesn't have to. That means body,<br>
> query string, cookies and so on aren't parsed until you need them,<br>
> saving resources in the process at the expense of a few more characters<br>
> to write.<br>
<br>
</div>I see, but it's not *just* the extra characters, there's the mental<br>
overhead of having to remember to thread the state through, and<br>
there's the added complexity of the lazy parsing/reading which could<br>
be harder to debug. Whether that's a good trade-off for performance I<br>
don't know, but IMO it's not an API that would be easy to use.<br>
<br></blockquote><div><br></div><div>This conversation reminds me of the erlando parse_transform and its do-notation: <a href="http://www.erlang-factory.com/upload/presentations/435/MatthewSackman.pdf">http://www.erlang-factory.com/upload/presentations/435/MatthewSackman.pdf</a>. That, in turn, reminds me of several enormous threads about how the syntax could/should change or be improved upon. There are also one or two outstanding EEPs regarding this issue. </div>
<div><br></div><div>Personally I find pulling things out into an Explaining Function removes a lot of the tedium, at least for the reader, if not the author of the code. Like Joel, I'm a bit of a fanatical in-liner, but I also know people who *swear* by having an Explaining Variable for ever last bit of intermediate state.</div>
<div><br></div></div>