Robert Bradshaw, 03.12.2009 18:15: > On Dec 3, 2009, at 12:56 AM, Stefan Behnel wrote: >> So my proposal is to enable type inference by default (after fixing >> the remaining bugs), but only for Python types (including extension >> types). > > Sounds like it would be safe (and very useful) to me. The only thing > that can happen on assignment between object types is a type check, > and the type inference engine infers based on the set of assignments, > so I don't see how it could go wrong.
Implemented in http://hg.cython.org/cython-devel/rev/c0e5e7195070 I noticed that type inference wasn't available for type constructors. It is now: http://hg.cython.org/cython-devel/rev/ba5ae565b3d2 Robert, I didn't quite understand the comment in NameNode.infer_types(). Is there a reason why this wasn't enabled in the first place? Enabling the 'safe' mode breaks one (1!) test file in the test suite, typedfieldbug_T303. It was actually depending on the fact that MyType() returns a generic object, not something that is known to be an instance of MyType (with known readonly fields that are accessible at C level). This is really unlikely to break code IMHO, but we'll have to check our own test suite to make sure we didn't accidentally send some tests into void space by enabling some unexpected optimisations for them. Still, I left the default setting for the infer_types option as 'none' until we can be sure it works for all nodes. SliceIndexNode is still pending (which makes me wonder why this didn't show up in the test suite...). Once that's fixed, I'd vote for setting the option to 'safe' by default. Would that go in for 0.12.1 or should we wait for 0.13? (Maybe we should give Sage a build before answering that ...) Stefan _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
