Static vs. dynamic
Posted Mar 27, 2009 12:17 UTC (Fri) by
pboddie (subscriber, #50784)
In reply to:
A look at Parrot 1.0 by Ze
Parent article:
A look at Parrot 1.0
I'd argue that type discovery (and particularly over the whole program) allows us to to infer the type in the vast majority of cases.
It's possible to do whole-program inference, but it's expensive. I think many people see functional programming languages employing type inference and consider that dynamic languages are as suitable for the application of similar techniques, but the scale of dynamicity undermines these techniques: assumptions that hold for languages like ML are gone in languages like Python.
I'd also argue that dynamically typed languages are horrible hacks :p I'd much rather have a compiler automatically test for some errors than rely on them to be produced at runtime.
Tests based on type declarations only cover a certain class of errors, as almost everyone should know by now. Dynamic languages obviously save the programmer from having to specify apparently obvious boilerplate, potentially permitting behaviour that would be awkward to define in many statically typed languages. However, restricting the dynamicity of such languages can lead to useful inference about program characteristics and can reveal errors, too.
I'd be happy to see a variant of Python with some of the more blatant dynamicity removed. For example, dynamic definition of classes has never really been very useful for me, so if that went away and enabled better program analysis, I'd be quite pleased with the compromise.
(
Log in to post comments)