What is Expressiveness in a Computer Language

Marshall marshall.spight at gmail.com
Fri Jun 23 18:45:29 CEST 2006


Pascal Costanza wrote:
> Marshall wrote:
> > Pascal Costanza wrote:
> >> Consider a simple expression like 'a + b': In a dynamically typed
> >> language, all I need to have in mind is that the program will attempt to
> >> add two numbers. In a statically typed language, I additionally need to
> >> know that there must a guarantee that a and b will always hold numbers.
> >
> > I still don't really see the difference.
> >
> > I would not expect that the dynamic programmer will be
> > thinking that this code will have two numbers most of the
> > time but sometimes not, and fail. I would expect that in both
> > static and dynamic, the thought is that that code is adding
> > two numbers, with the difference being the static context
> > gives one a proof that this is so.
>
> There is a third option: it may be that at the point where I am writing
> this code, I simply don't bother yet whether a and b will always be
> numbers. In case something other than numbers pop up, I can then
> make a decision how to proceed from there.

Ouch; I have a really hard time understanding this.

I can't see how you'd call + on a and b if you think they might
not be numbers. If they could be something other than numbers,
and you're treating them as if they are, is that sort of like
doing a case analysis and only filling in one of the cases?
If so, wouldn't you want to record that fact somehow?


Marshall




More information about the Python-list mailing list