On Dec 8, 2009, at 4:54 AM, Dag Sverre Seljebotn wrote:
> Stefan Behnel wrote:
>> Robert Bradshaw, 08.12.2009 00:41:
>>
>>> cython.infer_types(None) # the default, "safe" inference.
>>>
>>
>> Note how "infer_types(None)" basically reads "do not do any type
>> inference"
>> in the source that uses it. However, that would be
>> "infer_types(False)".
I guess this comes from a convention in Sage where one does
def some_calculation(proof=None):
...
where one can pass True or False, and passing None (or nothing at all)
falls back to a global default. I'm all for keywords as well.
> Just to make a point, I think it should be
>
> - infer_types(True) - unsafe mode
> - infer_types(False) - backwards-compatible mode
> -
> _hidden_developers_only_directive_turn_off_inference_completely(True)
> - absolutely no inference
I think we should support True (unsafe)/False (backwards compatible)
as the official interface, and then have extra keyword arguments,
which may not be forwards compatible, for developer use only.
I don't like the label "unsafe," in particular, we shouldn't leak that
to the user. It's not unsafe to use, only unsafe to turn on by default.
> Similarily for "bint" etc. I think there's a limit to how much of the
> language should be controllable by compiler directives; sometimes we
> have to just make choices on the users behalf, or the result will be
> completely unusable.
Good point.
> If we have to do tweaks to double and bint to get acceptable default
> behaviour, but would like a switch for backwards-compatability, a
> simple
> language_level("0.12") directive would be better.
This would seem to imply a promise to make everything the same... even
stuff we don't think about. Also, would we support every language
level? If people need the old semantics, old versions are always still
around. Actually, I hope things don't change so much we need to
differentiate between language levels...
- Robert
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev