Very Horrible Question About Goto's

Warren Postma embed at geocities.com
Wed Apr 19 10:53:57 EDT 2000


>I'm trying to create a converter from our own internal language (horrid)
into python.
> My only problem so far is that the original language uses *LOTS* of
goto's.
>Is there any way that this can be replicated within python ?

Sounds like you're trying to avoid dealing with the Accidental Complexity in
your system. You'd probably find that it's going to kill you if you don't
deal with it.  I'm saying this only because I've done that myself. <grin>

However, I find programmers like myself are always loath to wander into
irreducibly complex problems without first trying to take a stab into the
heart of whatever complexity they've run up against. Given that, you might
get Creative and try to write a code-analyzer and translator in Python to
parse all your Horrid 1.0 Sources and output the sorts of "meta-data" that
might help you in constructing your new system, or even help you automate
your conversion process.

People on this newsgroup are always up for a challenge, so why not post a
sample snippet of Horrid 1.0 and say what you'd like to do with it to
Pythonize it.

It's also possible for you to consider a "state based" or "event model"
based system for your existing code. You could create a dictionary of state
objects, and a "directed graph" model of showing the connections from state
to state. If you want to be really slick, make a visual model of your
state-charts. :-)

We are working on a state-based model of programming for Python, probably
going to use C.T's stackless-python eventually, but for now we are just
playing with some trivial python scripts to get a prototype of our event
model working. I am also considering the "graph" capabilities of the little
kjBuckets extension (see the GadFly web page for this little C extension)
which provides some extremely Nifty and Fast set/graph/dictionary extensions
that are helpful in this sort of case.

Warren







More information about the Python-list mailing list