Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to change syntax for pxd function typing #702

Closed
robertwb opened this issue Nov 28, 2008 · 10 comments
Closed

Need to change syntax for pxd function typing #702

robertwb opened this issue Nov 28, 2008 · 10 comments

Comments

@robertwb
Copy link
Contributor

The new inline pxd functions conflicts in syntax with the recently introduced method of having a pure Python function in the .py file and the types for the function in a corresponding pxd file. Cython 0.11 should not be released without fixing the syntax we want to support for the future so I made this a blocker.

The scheme settled on in mailing list:

> > I'm generally -1 on adding new syntax, but what I had wasn't very  
> > clear either. Would it be enough to accept a locals decorator?

I think that's a very clean compromise. You can

a) specify the signature in .pxd files as you would in .pyx files, just
without a function body.

b) write importable inline functions in .pxd files as a function with body,
just as you would in a .pyx file.

c) specify local variable types for a .py implemented function in a .pxd
file by adding a decorator to a function signature, but without providing a
function body.

So, whenever a function signature in a .pxd file has a body at all, it must
be a complete inline function.

I actually don't think that users would intuitively expect the current way
of defining local variables in .pxd files to work.

'''Note''' that this may require extending decorator support (in Parsing.py) to cdef functions. They should all probably simply be let through, and then disallowed again (except for @cython.locals) in PostParse.

At 2009-02-20T00:47:29Z @dagss added attachment 200.diff

Migrated from http://trac.cython.org/ticket/143

@robertwb
Copy link
Contributor Author

@dagss changed component from Build System to Parsing
commented

@robertwb
Copy link
Contributor Author

robertwb commented Jan 28, 2009

@dagss commented

I think http://trac.cython.org/ticket/143 could be partially fixed
and made a feature request instead by at least disallowing the current
way of typing local vars in pxd files, without necesarrily introducing a
new way of doing it.

@robertwb
Copy link
Contributor Author

@dagss changed owner from somebody to dagss
commented

@robertwb
Copy link
Contributor Author

@dagss commented

Fix attached, this can be closed when I get to push it or someone else applies it.

@robertwb
Copy link
Contributor Author

robertwb commented Feb 20, 2009

@dagss commented

'''NB!''' The comments above were for http://trac.cython.org/ticket/200, this was for the wrong ticket. (Now where have those edit and delete buttons gone to in this Trac version -- yes, I'm still TRAC_ADMIN...hmmm...)

@robertwb
Copy link
Contributor Author

@dagss changed owner from dagss to somebody
commented

@robertwb
Copy link
Contributor Author

robertwb commented Mar 8, 2009

@robertwb changed resolution to fixed
status from new to closed
commented

@robertwb
Copy link
Contributor Author

scoder changed resolution from fixed to empty
status from closed to reopened
commented

@robertwb
Copy link
Contributor Author

scoder changed owner from somebody to dagss, robertwb
status from reopened to new
commented

@robertwb
Copy link
Contributor Author

scoder changed resolution to fixed
status from new to closed
commented

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant