A really bad idea.

M marvelan at hotmail.com
Sat Nov 16 13:52:36 EST 2002


There seems to be many opinions about my post. That is good. Thanks everybody
for discussing this. 

To add fuel I just meantion a few more or less random points...

I'll give you a list of things you must consider when
specifying a function interface in C++. I use C++ as my personal horror
story generator but you could possibly replace C++ with many other
languages. The reason why I make this example is to show something I would
like never to be needed for Python.

So, to define a function in C++, please consider the following:

1) Operator or non-operator function?
2) Free or member function?
3) Virtual or non-virtual function?
4) Pure or non-pure virtual member function?
5) Static or non-static member function?
6) const or non-const member function?
7) Public, protected, or private member function?
8) Return by value, reference, or pointer?
9) Return const or non-const?
10) Optional or required argument?
11) Argument by value, reference or pointer?
12) Pass argument as const or non-const?
13) Friend or non-friend function?
14) inline or non-inline

This is just *one example*. (C++ happens to be the victim here because
I have programmed it) I could have picked something else horrible
about class templates or template parameters or whatever. Nevertheless my
point is that a language can be too complex when trying to make it
powerfull. A function is really a simple abstraction, why make it this
complex? 

Some of the posters say that it is "just to learn python properly". Yes, that
would be nice if all programmers in all projects in the world had several years
or more experience in using the tools/languages of the project. But this
is not reality (not mine anyway). Many times people end up fixing things 
and adding modules using languages they have never seen and will never see
again. If trying to do this with a complex language that is hard to read one
could easily predict the results...

Its also about $$. I don't want a programmer to be stuck in trying to
understand a complicated language feature. It does not provide value to
our customers. I want a language to be simple, simple, simple. But not
simpler than that ;-) Don't throw in a nice feature that can solve a problem
in a few lines of code if the same problem can already be solved with
the language. Just and example. Operator overloading. Why should we have it?
Just so that you can write vector1 + vector2 instead of vector1.add(vector2)?
Maybe not the best example but I hope you understand my point.

A language that does not give programmers suprises is good. A high suprise
factor just gives you more bugs. The addition of default behaviour can be one
such thing. Look at Perl. Lots of things happen without that you
can see it in the code. It should not happen if you can not see it in
the code! (C++ again; crash before entering main anyone?).


/Marv

Keep on writing...



More information about the Python-list mailing list