Re:Anders Hejlsberg Is Right: You Cannot Maintain Large Prog...
by regularfry on Tuesday June 05, 2012 @05:24AM
(#4068008)
I'd have thought that taking a leaf out of Go's book and having passively-defined interfaces would be a useful concept for linter hints.
Re:Anders Hejlsberg Is Right: You Cannot Maintain Large Prog...
by berntb on Tuesday June 05, 2012 @05:21AM
(#4068002)
>>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/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. :-)
Re:Anders Hejlsberg Is Right: You Cannot Maintain Large Prog...
by mickeyp on Tuesday June 05, 2012 @06:19AM
(#4068094)
I 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.
Python 3 does have type annotations for use by linting tools, but it'll be another 5-6 years before we'll see that filter down into the current Python ecosystem. And even then, it's only as good as the weakest (non-annotated) piece of code. Retrofitting libraries and existing code will bring about its own issues: how do you accurately hint to linters, in a language that encourages duck typing, the type a method parameter is likely to take?