Closed TheDataLeek closed 8 years ago
Sounds good to me. Started working on it. However, can't do much or respond frequently due to certain personal issues.
No worries. I've been working on this for the last few days. I'll get back to you when I have something more concrete.
Callables should be working now. It expects a callable with annotations. If it is a safe callable (runtime validation was previously applied to it), it will only check if it has an expected signature. Otherwise, it has to be wrapped in a proxy object and runtime type safety checks must be applied after that. Such a transparent proxy is needed because we don't want to mutate an object implicitly.
If there are still some corner cases, please feel free to report - I will reopen the issue.
Callables are not currently working, as referenced in #3.
Thinking about callable objects, I think the best way to handle them is as follows.
Let's say we have some function that takes another function as an argument with correct type hinting syntax.
I think that the best way to handle this is to also require that the argument passed in
func
needs to also have complete type annotation.With
func
possibly also checked at runtime depending on whether or not theenforce.runtime_validation
decorator is applied. The only thing that the high level functionfoo
checks is that the call signature offunc
matches the type hinting specified.How's that sound?