<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div dir="ltr"><br>
      <br>
      On 01/07/2014 03:38 PM, Brett Cannon wrote:<br>
      <div class="gmail_extra">
        <blockquote type="cite">
          <div class="gmail_quote">On Tue, Jan 7, 2014 at 6:24 PM, Larry
            Hastings <span dir="ltr"><<a moz-do-not-send="true"
                href="mailto:larry@hastings.org" target="_blank">larry@hastings.org</a>></span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div bgcolor="#FFFFFF" text="#000000">
                <div class="im">For what it's worth, if we use the
                  "accumulator" approach I propose that the generated
                  code doesn't go at the very end of the file.  Instead,
                  I suggest they should go *near* the end, below the
                  implementations of the module / class methods, but
                  above the methoddef/type structures and the module
                  init function.<br>
                </div>
              </div>
            </blockquote>
            <div><br>
            </div>
            <div>If it is accumulated in a single location should it
              just be a single block for everything towards the end?
              Then forward declarations would go away (you could still
              have it as a comment to copy-and-paste where you define
              the implementation) and you can have a single macro for
              the PyMethodDef values, each class, etc. If you
              accumulated the PyMethodDef values into a single macro it
              would help make up for the convenience lost of converting
              a function by just cutting the old call signature up to
              the new *_impl() function.<br>
            </div>
          </div>
        </blockquote>
        <br>
        I *think* that would complicate some use cases.  People
        occasionally call these parsing functions from other functions,
        or spread their methoddef / typeobject structures throughout the
        file rather than putting them all at the end.<br>
        <br>
        I'm proposing that the blob of text immediately between the
        Clinic input and the body of the impl contain (newlines added
        here for clarity):<br>
        <blockquote>static char *parsing_function_doc;<br>
          <br>
          static PyObject *<br>
          parsing_function(...);<br>
          <br>
          #define PARSING_FUNCTION_METHODDEF \<br>
              { ... }<br>
          <br>
          static PyObject *<br>
          parsing_function_impl(...)<br>
        </blockquote>
        Then the "accumulator" would get the text of the docstring and
        the definition of the parsing_function.<br>
        <br>
        <br>
        On the other hand, if we wanted to take this opportunity to
        force everyone to standardize (all methoddefs and typeobjects go
        at the end!) we could probably make it work with one giant block
        near the end.<br>
        <br>
        Or I could make it flexible on what went into the accumulator
        and what went into the normal output block, and the default
        could be everything-in-the-accumulator.  Making the common easy
        and the uncommon possible and all that.  Yeah, that seems best.<br>
        <br>
        <br>
        <i>/arry</i><br>
      </div>
    </div>
  </body>
</html>