<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <br>
    Mark Shannon, Dmitry Jemerov (from PyCharm) and I sat down to talk
    about rearchitecting the Argument Clinic prototype to make it easily
    to interact with.  We came up with the following.<br>
    <br>
    The DSL will now produce an intermediate representation.  The output
    will consume this intermediate representation.<br>
    <br>
    The two defined outputs from the IR so far:<br>
    <ol>
      <li>The inplace generated C code (what it has right now), and</li>
      <li>Argument Clinic DSL code itself.</li>
    </ol>
    <p><br>
      The intermediate representation will be subclasses of
      inspect.Signature and inspect.Parameter that add the extra bits of
      information needed by Argument Clinic, as follows:<br>
    </p>
    <p>class Function(inspect.Signature):<br>
              name = 'function name'<br>
              module = 'module name if any<br>
              class = 'class name if any, can't actually call this
      class'<br>
              docstring = 'function docstring'<br>
              c_id = 'stub id to use for generated c functions'<br>
              return_converter = SeeBelow()</p>
    <p>class Parameter(inspect.Parameter):<br>
               docstring = 'per-parameter docstring'<br>
               group = <group membership integer or None><br>
               converter = ConverterFunction()<br>
    </p>
    Parameter.group is an integer, specifying which "option group" the
    parameter is in.  This must be an integer for positional-only
    arguments, and None for other argument types.  0 indicates "required
    positional-only parameter".  Left-optional groups get negative
    numbers, decreasing as they get further from the required
    parameters; right-optional get positive numbers, increasing as they
    get further from the required parameters.  (Groups cannot nest, so a
    parameter cannot be in more than one group.)<br>
    <br>
    Function.return_converter was suggested by Mark.  This is the
    inverse of the per-parameter converter function: it defines the
    return type of the impl function, and the conversion process to turn
    it into the PyObject * that gets returned to Python.  And, like the
    converter functions, it will define the actual return annotation of
    the function (if any).<br>
    <br>
    Mark wants to write something that parses C code implementing
    builtins and produces the IR; he can then use that to write Argument
    Clinic DSL.  This will make the conversion process go much more
    quickly.<br>
    <br>
    <br>
    <i>/arry</i><br>
  </body>
</html>