Python from Wise Guy's Viewpoint
Pascal Costanza
costanza at web.de
Tue Oct 28 19:29:23 EST 2003
Matthias Blume wrote:
> Pascal Costanza <costanza at web.de> writes:
>
>
>>Matthias Blume wrote:
>>
>>
>>>Pascal Costanza <costanza at web.de> writes:
>>
>>>>I think that Neelakantan has better examples for programs that are
>>>>possible to write with a statically typed language, but not with
>>>>dynamically typed ones. (Not 100% sure yet, though.)
>>>
>>>There are no such programs, obviously. You can always translate a
>>
>>>statically typed program into a dynamically typed one (and vice
>>>versa).
>>
>>No, for christ's sake! There are dynamically typed programs that you
>>cannot translate into statically typed ones!
>
>
> Yes you can. (In the worst case scenario you lose all the benefits of
> static typing. But a translation is *always* possible. After all,
> dynamically typed programs are already statically typed in the trival
> "one type fits all" sense.)
No, that's not all you need to do. Essentially you would need to write a
complete interpreter/compiler for the dynamically typed language on top
of the statically typed one, _if_ you want runtime metaprogramming.
That's not what I would call a straightforward translation.
But this is really getting tiring.
> [This whole discussion is entirely due to a mismatch of our notions of
> what constitutes expressive power.]
No, it's not. There's a class of programs that exhibit a certain
behavior at runtime that you cannot write in a statically typed language
_directly in the language itself_. There's no program that exhibits a
certain behavior at runtime that you can only write in a statically
typed language. [1]
That's a fact that you simply don't want to admit. But you're
objectively wrong here.
However, the horse is beaten to death by now.
Good bye.
Pascal
[11 Except perhaps for a class of programs that would change their
runtime and/or space complexity, provided they would need lots of
dynamic type checks. But I haven't sorted out yet whether this class
really exists.
More information about the Python-list
mailing list