[Cython] [cython-users] Cython .pxd introspection: listing defined constants

Robert Bradshaw robertwb at math.washington.edu
Thu Mar 3 19:54:00 CET 2011


On Thu, Mar 3, 2011 at 4:13 AM, W. Trevor King <wking at drexel.edu> wrote:
> On Wed, Mar 02, 2011 at 06:08:12PM -0800, Robert Bradshaw wrote:
>> On Wed, Mar 2, 2011 at 5:54 PM, W. Trevor King <wking at drexel.edu> wrote:
>> > Previous discussions in this thread [1,2] have discussed the issues
>> > associated with overloading the 'public' keyword.  For an example of
>> > the difficulties this causes, see the ugly workaround [3] in my recent
>> > commit [4].  Definately worth fixing this syntax.
>> >
>> > How do syntax changes with deprecations work?  The Parsing module
>> > doesn't seem to be setup to handle things like that.
>>
>> It's not.
>>
>> We rarely deprecate syntax, and we should at least give people a
>> chance to move away from the old syntax first to the new first, so
>> we'll have to support both for a bit at least. When we do deprecate
>> the old way of doing things, I think we'll just use
>> Errors.warning(...).
>
> But how would you know which syntax version the source file was aiming
> for?  There should probably be a way to explicitly specify a Cython
> syntax version, probably from the command line and/or setup.py file,
> e.g.
>
>  pyrex_syntax_version = (<major version>, <minor version>, <sytax bugfix>)
>
> as an argument to Cython.Distutils.extension.Extension, which would
> select the appropriate parser.  The default (if the version was not
> explicitly set), would be to use the current parser.  With this setup,
> projects would only be forced to upgrade if Cython removed support for
> their syntax entirely, and they could choose to upgrade whenever was
> most convienient for them.
>
> I think the syntax version's major/minor number should probably match
> the Cython version in which they were introduced.  Parser fixes and
> compatible extensions would bump the <syntax bugfix> number, and you'd
> probably want to deprecate buggy versions more quickly.

With the single exception of introducing the cpdef keyword, I can't
think of a single instance where Cython's syntax has ever been changed
in a backwards incompatible way, so we've never needed to worry about
syntax versioning. I don't see anything with the new syntax that's
forcing us to be backwards incompatible, and even the local ugliness
of supporting both for the time being is better than going down the
route of supporting multiple parsers.

- Robert


More information about the cython-devel mailing list