Re: History of code completion

"Jan Gray" <jsgray@acm.org>
23 Oct 2001 20:23:20 -0400

          From comp.compilers

Related articles
History of code completion gswork@mailcity.com (2001-10-20)
Re: History of code completion lex@cc.gatech.edu (Lex Spoon) (2001-10-21)
Re: History of code completion neelk@alum.mit.edu (2001-10-23)
Re: History of code completion jsgray@acm.org (Jan Gray) (2001-10-23)
Re: History of code completion lhp+news@toft-hp.dk (2001-10-23)
Re: History of code completion gzw@home.com (Geoff Wozniak) (2001-10-27)
Re: History of code completion marcov@toad.stack.nl (Marco van de Voort) (2001-11-05)
Re: History of code completion genew@mail.ocis.net (2001-11-08)
Re: History of code completion binary@eton.powernet.co.uk (Richard Heathfield) (2001-11-08)
Re: History of code completion lex@cc.gatech.edu (Lex Spoon) (2001-11-08)
[3 later articles]
| List of all articles for this month |

From: "Jan Gray" <jsgray@acm.org>
Newsgroups: comp.compilers,comp.programming
Date: 23 Oct 2001 20:23:20 -0400
Organization: Gray Research LLC
References: 01-10-091
Keywords: tools, history
Posted-Date: 23 Oct 2001 20:23:20 EDT

(Despite the content overlap, I composed this reply before reading Lex
Spoon's article.)


"gswork" <gswork@mailcity.com> wrote
> So I'm quite interested in the history of code completion in IDE's &
> code editors. Does anyone have any info or personal recollections,
> or even opinions on the merits/demerits of code completion?


Looking Glass Software's Alice Pascal, a syntax directed editor,
interpreter, and debugger for teaching Pascal, had context sensitive
code completion. It shipped for DOS PCs and CEMCORP ICONs in 1985,
and for Atari STs in 1986. You can read about it, and download the PC
and ST versions of Alice, source code and all, from Brad Templeton's
Alice Pascal page at http://www.templetons.com/brad/alice.html. The PC
version is a DOS exe that uses a curses layer, writing directly to
VGA/EGA, and it still seems to run properly on my Windows 2000
machine.


Here are some of the things you could do / can do in Alice Pascal.


1. Go to any placeholder, press ALT+T, and get a popup menu of syntax
elements and/or identifiers that are valid there.


2. Declare a new symbol (variable, type, etc). Go to a placeholder
that expects that kind of symbol. Press the END key to obtain a popup
menu of all current symbols that are valid there. Or, type the first
letter or two of the identifier, press END, and its name is completed
(or, if more than one is possible, a popup list of (context valid)
names with that prefix appears). Ditto for prompting for / completing
the names of valid fields of a record on the RHS of a '.' field
expression.


3. Debug, single-step, etc. even partially completed programs. Or,
enter a statement in the 'immediate mode' window, press ENTER, and run
it.


4. Hide and reveal code blocks (source code outlining).


5. Edit the declaration of a symbol to rename all uses of it.


One thing you couldn't do was enter a syntactically incorrect program.
(After the addition of a text-editor-expression-parser, you could
enter syntactically incorrect *expressions*.) And if an edit
introduced a semantic error, (e.g. a type error), Alice would often
diagnose the error immediately.


Alice Pascal demonstrated many helpful uses of an AST. But it also
showed that syntax directed editing was a dead end. The programming
community was not willing to unlearn programming (by gradually
refining syntactically incorrect program snippets) in a text editor,
in favor of power-assisted programming (by entering program tree
elements in prefix order), even if you provide a lot of nice
conveniences and benefits.


That's OK. You don't need syntax directed editing to obtain an
AST. You can always recover an AST with a background compilation
process from within the IDE. On modern machines you can probably do
this after every keystroke or pause, parsing (as best you can) what
the user has entered, in order to recover as much partial AST as you
can, in order to provide context sensitive assistance, instant
cross-reference browsing, etc.


Alice influenced my later work on various VC++ features (unrelated to
IntelliSense), but that was long years ago. These days I love the
IntelliSense code prompting and completion in VS.NET beta 2. It makes
exploring the vast surface area of the .NET Framework Class Library
easy and fun.


I was lucky to work for Brad on Alice Pascal. I learned so much from
him. True story: once we were up late, testing some new AST
manipulation code. Editing worked -- you could load, save, edit your
program just fine. Execution worked -- press F1 (RUN) and your
program ran. Oops! Hide/reveal was broken. If you selected a block of
code and tried to HIDE it (collapse it in the program outline) and
then REVEAL it again, the AST could be corrupted. Without missing a
beat, we both looked up and exclaimed "You can RUN but you can't
HIDE!"


Jan Gray
Gray Research LLC


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.