Python aka. Smalltalk Lite?

Bijan Parsia bparsia at email.unc.edu
Sun Feb 13 23:13:09 EST 2000


Fredrik Lundh <effbot at telia.com> wrote:

> Markus Kohler <kohler at medien.tecmath.com> wrote:
> > > seriously, what are the major shortcomings in Python
> > > from a Smalltalk professional's perspective?
> > -- Smalltalk's calling mechanism is much simpler than Pythons making it
> > easier to compile.
> 
> can you elaborate?

Probably not, but that doesn't necessarily stop me (even *if* this was
addressed to Markus ;))

> as I see it, python's calling mechanism involves passing
> a tuple (and an optional keyword dictionary) to a callable
> object.  how does smalltalk differ from this?

I suspect that Markus may have meant the lookup mechanism, though I'm
not sure. I don't know that either the lookup or the call mechanism is
"simpler" but it certainly seems *cheaper*. I.e., the cost of a method
send is typically negligable. But I suspect that this is a
implementation issue.

> > Almost every Smalltalk implementation I have seens runs
> > faster than Python.
> 
> just one simple question: reading some smalltalk code makes
> me think that smalltalk requires you to declare what instance
> variables you're going to use?  is this true?

I'm not sure what you mean. You define classes with ivars, yes. You can
change these at anytime, including programmatically. You can catch
message sends to non-existent methods (including calls to accessors of
non-existent ivars) and redirect them in various ways (including by
trapping #doesNotUnderstand:). 

> can you add extra stuff to an instance afterwards without
> any extra cost?

There are a variety of things you can do with a variety of costs. It's
certainly easy enough, for example, to implemente the __get_attr__,
__set_attr__ and friends stuff.

> (should of course figure that out myself, but I don't seem
> to be squeak-compatible ;-)

Sorry to hear that. I'm sure I could help you get up and running. We
start with a quick little brain reformat...

Cheers,
Bijan Parsia.



More information about the Python-list mailing list