Mailing List Archive

Support open source code!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Python discussion, anybody?



<< Now, how about event-oriented programming? >>
<< Well, you have a problem here.>>

   I mentioned this (once again) from the beginning. Your example is one of 
downcasting--downcasting is evil, despite the fact that Java containers and 
certain GUIs make such use of it. I'm happy to just ignore the aftereffects 
of all explicit casting, leaving those problems until runtime. Even in C++, 
Java, or any other strongly typed language that allows this nonsense, code 
such as your example can crash at runtime due to a type mismatch. The 
correct OO way to handle events is to specify callbacks, not to have a loop 
that accepts a generic "Event" and then downcast--but if you insist on 
something being done at Runtime, then so be it.
  As for whether a strongly typed "scripting" language has a place--you can 
already find many places where Perl, Java, C, C++, Python, etc, overlap. 
People ARE using Perl to write large programs, and Java to script web-pages 
(I've even heard of certain very popular web-pages in C). The main advantage 
of weak-typing is that you don't have to write as much redundant 
information. The (very serious) disadvantage (which was the original point 
of this thread) is that many simple mistakes aren't found until runtime. 
It'd be nice to have a tool to find these simple mistakes. It'd be nice to 
have a language where you don't have to specify an interface, but could just 
pass objects along and let it catch (before runtime) if you haven't 
implemented something necessary. I certainly don't appreciate compromises 
like Java, where writing the interfaces and wrapper functions (for 
containers, e.g.) is so tedious that one has to downcast all over the place, 
or invent your own "templating" solution.

  E.g., one more time: if I call 'sort' on a list of nantokas, it would tell 
me "Sort requires you to implement int nantoka.compare(nantoka)", BEFORE 
runtime, without any need for a silly "Comparable" abstract-base-class to be 
defined anywhere (this is what Java does). I suspect Python and Smalltalk 
may fit the bill (although the tool doesn't exist AFAIK), but there may not 
be a language (yet) that would be right for this.

cheers,
Todd
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at 
http://profiles.msn.com.


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links