Closed kennknowles closed 10 years ago
Yes we should definitely do this! What do you mean by reflection?
Hardly qualifies as reflection in a dynamic language... https://github.com/kennknowles/python-rightarrow/blob/master/rightarrow/enforce.py#L7
Oh! You mean overload guard
to check if it's a contract or a string (in which case parse the string into a contract). Yeah, that'd work.
so, what if we used the function tostring method and parsed type signature information out of it? something like:
inc = c.guard(function(x){
/* (Num) -> Num */
return x+1;
});
We've moved to using macros so I don't think we need this anymore.
I would love for the following to be equivalent to writing out the AST longhand in Javascript.
Eliding the call to
parse
using reflection is presumably safe as well?