What is Expressiveness in a Computer Language
Chris Smith
cdsmith at twu.net
Fri Jun 23 19:08:31 CEST 2006
Marshall <marshall.spight at gmail.com> wrote:
> 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?
The obvious answer -- I don't know if it's what Pascal meant -- is that
they might be 4x4 matrices, or anything else that behaves predictably
under some operation that could be called addition. As a mathematical
analogy, the entire mathematical field of group theory comes from the
idea of performing operations on values without really knowing what the
values (or the operations) really are, but only knowing a few axioms by
which the relationship between the objects and the operation is
constrained.
[As an interesting coincidence, group theory papers frequently use the
addition symbol to represent the (arbitrary) binary relation of an
Abelian group. Not that this has anything to do with choosing "+" for
the example here.]
Programming languages do this all the time, as well. The most popular
example is the OO sense of the word polymorphism. That's all about
being able to write code that works with a range of values regardless of
(or, at least, a range that less constraining than equlity in) types.
--
Chris Smith - Lead Software Developer / Technical Trainer
MindIQ Corporation
More information about the Python-list
mailing list