Functional programming

Chris Angelico rosuav at gmail.com
Tue Mar 4 15:17:43 CET 2014


On Wed, Mar 5, 2014 at 1:05 AM, Mark Lawrence <breamoreboy at yahoo.co.uk> wrote:
> On 04/03/2014 13:30, BartC wrote:
>>
>>
>> But declaring variables is not just about specifying a type; it registers
>> the name too so that misspelled names can be picked up very early rather
>> than at runtime (and that's if you're lucky).
>>
>
> I've said before that this, to me, is one of the major downsides of dynamic
> typing.  Once a statically typed language has been compiled the programmer
> can head down to the pub.  The programmer using dynamically typed languages
> has to hang around doing long, boring, tedious testing.  Unless they're
> using an IDE like Pydev and have Pylint turned on so it picks up errors as
> they type, in which case they can also head down to the pub.

Type declarations are orthogonal to that. ECMAScript, as mentioned,
just has 'var'. If it didn't have the implicit variables rule
(anything not explicitly declared goes onto the primary object), it'd
give you exactly that functionality, without any type checking at all.

And there's not "static" and "dynamic". It's a spectrum. Each time you
move one direction, you gain a set of potential bugs that the language
can detect; each time you move the other direction, you save on
keyboarding. But at no time do you truly get away from the need to
test, because anything non-trivial can't be proven by the language
anyway.

ChrisA



More information about the Python-list mailing list