4 ms·
>>how do you accurately hint to linters, in a language that encourages duck typing, the type a method parameter is likely to take? You didn't check the Method:
by berntb 14y ago
>>how do you accurately hint to linters, in a language that encourages duck typing, the type a method parameter is likely to take?
You didn't check the Method::Signatures link or do I misunderstand your position?
Also check Moose@CPAN, which have typing of object attributes. It isn't like a fully typed language, but it should help a lot.
Edit: Link discussing type checking of attributes in Perl. Should be possible to have something similar in other dynamic languages? http://search.cpan.org/~doy/Moose-2.0602/lib/Moose/Util/TypeConstraints.pm http://search.cpan.org/~doy/Moose-2.0602/lib/Moose/Util/Type...
Edit: Please check the links and see if Perl solves your problems? I am curious. (-: Writing a PEP to get something similar into Python is optional. :-)
- mickeyp 14y agoI didn't look, tbh. Python 3 already has type annotations, but what interests me if how do you nail down types whilst preserving duck typing, or dealing with a method that is already passed duck typed objects.
- berntb 14y agoI'm not going to copy/paste the content/source from links I've given. :-) (There are easy-to-read abstracts/"synopsis" at the start of both pages.)