Dealing With Legacy

Matthew Tuck matty@box.net.au
Sat, 12 Dec 1998 13:49:16 +1030


I've talked before about how I felt that legacy can cause a real problem
if you let it shackle the language, and how I didn't want this to
happen.  This message is a little bit more about how we could avoid this
situation.

The main problem is trying to mould our existing systems to work when
new, better ways have been discovered or implemented.  Often in
programming languages this is achieved through backward compatibility of
formats.  But there is another way.

The other technique is actually more prevalent in programs, that is,
format upgrading through translation.  If you open a word processor with
a document that was from an earlier format, it translates it.  In a
similar way we could do this with programs.  The main argument against
this for other languages is that in the translation you would lose such
things as comments, etc.  But we are already parsing/deparsing programs,
so the issue is irrelevant.  And because we're merely upgrading
incremental changes, you won't have any of the complexity of
inter-language translation.

Some things won't necessarily we easy to translate, such as classes that
have been replaced with another class of equivalent interface.  For
these, we would supply bridges (wrappers to the old class).  They would
be slightly inefficient, but hopefully would be mostly optimised back to
full efficiency.  And due to the global renaming that can be done on
source files, the bridges can be stored in a "compatibility" section of
the library, which means you don't have to bother about it if you don't
need it.

There would definitely be translators for the source format.  There
could also be translators for the module/program format if someone
didn't have the source code.

But if something could not be translated easily, then we still would not
be bound to translate it, it would have to be translated by hand.

I'm not necessarily advocating the compiler supporting previous formats,
but I am advocating a separate translation tool.  This is pretty
essential to the project though if we want to both bootstrap and not be
legacy shackled, since we need to translate the compiler!

-- 
     Matthew Tuck - Software Developer & All-Round Nice Guy
                              ***
       Check out the Ultra programming language project!
              http://www.box.net.au/~matty/ultra/