I think Evan's suggestion earlier on IRC about using the tokenize
module is a good one.  It's MUCH more robust than Pyrex.Plex and we
can do just about anything with it.  See
http://docs.python.org/dev/3.0/library/tokenize.html

This is my attempt at a very early draft for the .pym language, and
nothing in here should be read as dictation - just ideas.

* 100% compatibility with Python 3.0 syntax for parsers
  - will allow pydoc/etc parsers to work without a hitch
  - lowers the learning curve for existing Python coders significantly
  - as tokenize returns comments (it can be used for highlighters), we
can implement cinclude as #include, cdef as #def, IF as #if, etc
  - as those elements wouldn't be visible to Python in a compiled
module, they will not effect parsing at all
* C variables, types, struct elements, functions, etc retain the same names
  - provides predictability for external access
  - requires using unique names in some places for #def's
* C vs Python optimizations handled transparently
  - ie, "for i in range(4,10,2) :" given previous "#def int i" will
result in "for (i=4; i<10; i+=2) {"
  - special class methods (ie, __sub__ __rsub__) handled via standard
test/dispatch code in C
  - all classes and functions implemented in C, Python-side calls
these unless overridden (ie, after inheritance)

I would like to see, for example, PySoy's mutexes handled using the
"with" statement introduced with PEP 0343, and same with GIL.  thus,
"with GIL:" could continue to work as it does in Pyrex.
http://www.python.org/dev/peps/pep-0343/

Questions unanswered (that I can think of now):
  - how to handle class "properties"?
  - do special context managers (ie, gil/nogil) need to be defined in
the pym code at all, and what to do when they are
  - does there need to be a separate syntax for #def (constants) and C
variable declarations?
  - what syntax should be use to control whether a Python object is
automatically refcounted, or when it should/should not be refcounted?

This is by no means complete, just a starting place for further discussion
_______________________________________________
PySoy-Dev mailing list
[email protected]
http://www.pysoy.org/mailman/listinfo/pysoy-dev

Reply via email to