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

Re: Rather, DSSLs increase modularity, productivity




On Nov 20, 2003, at 6:40 PM, Daniel Silva wrote:

>> I'm not a Python expert, just a casual user.  But I don't see why
>> someone couldn't add (optional) type declarations to Python, with
>> Dylan-ish semantics.  Then you could do Dylan-style compilation and 
>> get
>> better performance for your Python.
>
> Because you can do this:
>
> class C(object): pass
> class D(object): pass
> myc = C()
> print myc              # <C object>
> myc.__class__ = D
> print myc              # <D object>

Which is why you should use Self-style compilation instead, and get the 
performance gains without the type annotations.  There may be many good 
reasons to add static type declarations to a program, but performance 
isn't one of them.  This was nicely demonstrated by the Strongtalk 
compiler, which aggressively optimized the code while *completely 
ignoring* the optional declared types.  At least when it comes to 
object oriented method dispatch, manifest typing and performance are 
orthogonal concerns.