What If..... Strong Types
Don Garrett
garrett at bgb.cc
Sun Jun 16 00:08:26 EDT 2002
I'm not suggesting any real changes to any, only proposing a thought
experiment.
What if Python had been built from the start with strong types? And I mean
strong types, not strong typing. The distinction I am trying to draw is that
variables would not be typed, but that all types would have rigid interfaces.
Primarily, what if classes always had rigidly defined interfaces. I mean
that public members had to be declared to exist, and that methods couldn't be
modified on an instance. Private members could exist but would be really private.
All types would be classes (including ints and such). Amoung other things,
I would add the concepts of Interfaces, instanceof operators.
Local variables would not require declaration, and would work just like
today. Introspection would work, but be read-only.
My belief is that almost all the convenience of Python would be maintained,
but that compilation, optimization, and automated code analysis would be simpler.
I'm just wondering if the change would be good or bad. Would it really
break anything important in Python today? Would it prevent any common errors?
Would it help with automated code analysis (compilation and optimization
included) as much as I think it would?
--
Don Garrett http://www.bgb.cc/garrett/
BGB Consulting garrett at bgb.cc
More information about the Python-list
mailing list