On Tue, Aug 5, 2008 at 9:49 AM, Dag Sverre Seljebotn
<[EMAIL PROTECTED]> wrote:
>
> Terminology first -- I don't really like the word pragma... "code
> generation options" are perhaps better? I've called them "(compiler)
> options" below and in the code base, while calling what is options today
> "arguments" (as it is command line arguments they really are).

Well, I also do not like the word 'pragma'. but take into accout that
is meaning should be clear for people with some C experience.

> Ways to set options:
> a)
> #cython: boundscheck=True, other=False
> #cython: third = no
>
> before any code in the file (but whitespace is allowed, I'm using
> Plex/the parser). The boolean value is case-insensitive and
> true/false/yes/no is allowed (is this too much? The thing is, for
> command-line arguments "True" is rather unfriendly and I'd like it to be
> consistent).

It is not to much at all. I would even ask for '1' and '0' also being
accepted for booleans.

> b) A command line argument "cython -O boundscheck=False,other=tRUe -O
> third=yes". This overrides the #cython comments, but NOT c) and d)
> listed below.

Well, '-O' smells to 'optimization' for me.

> c) A decorator works on function-scope:
>
> cimport cython
> @cython.boundscheck(True)
> def f():
>    ...
>
> d) A with statement:
> cimport cython
> with cython.boundscheck(False):
>    ...

I really prefer the decorator form. The 'with' form could require a
lot of identation if you want to set a lot for options.


> BTW, on "cimport cython": This is magic as well. I.e. it always is in
> front of the include path, and there will be no way to have a pxd file
> named "cython.pxd" imported. Is this OK? (I can change it but it would
> be less simple in more than one place, and people really should always
> have the cython scope available.)

If it is too magic, then perhaps 'cimport' should not be the way to
access the options. What about 'cython' being a sort or 'reserved
global'. Furthermore, perhaps 'cython' is not a good name. Perhaps in
the near future Pyrex can take some of your ideas. So perhaps is
better to find a 'neutral' name.



-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to