[plt-scheme] An Editors Tale
Jeremy Hylton <jeremy at alum.mit.edu> writes:
> I'm assuming the analysis would just need to be conservative. The
> expression L[2] is equivalent to L.__getitem__(2). You can't know, in
> general, whether a method call will have a side-effect, but method calls
> aren't a special case of the analysis.
You'd have to treat all indexing as calls to unknown functions. You'd
either have to do whole-world analysis or simply give up and say ``oh,
you used an index, I have no clue what *that* might do.''
For something like __getitem__ where you are likely to simply be
replacing the definition in one class, you could analyze that class to
determine the effect, but if you start introducing methods `on the
fly' by injecting them into instances via __setattr__, then knowing
the value at one time says nothing about the value at another.