Re: Automated indentation

Ray Johnson (rjohnson@freedom.rdd.lmsc.lockheed.com)
Mon, 16 May 94 19:01:31 GMT

In article <9405111940.AA19857=guido@voorn.cwi.nl> Guido.van.Rossum@cwi.nl writes:
>> What I'm most concerned about at the moment are applications where
>> people type fragments of Python code into dialogs that are implemented
>> with stupid text-entry "widgets". With the optional "end" delimiters
>> the user can be somewhat sloppy about indentation. Without it, he or
>> she is forced to do a lot of reindenting, possibly without even the
>> minimal sort of reformatting support that "vi" provides. I don't think
>> that will be very popular.
>>
>> I'm not just making this example up to be perverse. I really do have
>> some tools I'd like to create where I want the user to enter Python
>> bits into a Motif widget.
>
>Now seriously, don't you think that people will start complaining
>about such primitive text entry tools when they need to enter indented
>text? Entering C in a Motif widget isn't any more fun than entering
>Python -- imagine what it would look like if a user did not indent
>lines at all, relying totally on braces. Moreover, in that case,
>selecting a block to move around would be a nightmarge without a
>function to find matching parentheses...

>If you are at all serious about this, you'll have to give your tool at
>least the following features: auto-indent (i.e. typing RETURN or
>LINEFEED will insert whitespace at then beginning of the next line to
>match the previous line), a simple way to change the indentation of
>the current line, and a way to change to indentation of a group of
>lines (the region selected with the mouse). Almost all the other
>stuff that Emacs' Python mode does is mostly for power users, even the
>automatic indent after a line ending in a colon...

If I may jump in... At Lockheed's AI center we do alot of high level
prototyping. We usually use TCL for power end users to customize and
extend a given tool. In almost all cases it is sufficient to use a
standard text entry widget for this purpose.

If we used python instead (because it's a better language) we would have
to develop a variety of features to handle python's tab structure. Futher
more, those features would have to be added to each and every prototype
that we develop (extra overhead). Futhermore, the editing features of
a standard text widget are more of less universal and well understood.
(delete, return, tab, space, up, down, etc.) However, the additional
editing features required by python (mainly block indent/unindent)
are not universial. (Was that Meta-x block-indent or command I or what).
This, unfortunatly, means that adding end user code is not as intuitive
or requires extra work by us to handle pythons unique differences (like
a graphical menu etc.)

There are other reasons why we still have yet to shift to python. However,
the largest reason we still use Tcl over python is python's tab block
structure.

Ray

-- 
_____________________________________
Ray Johnson
Lockheed Artifical Intelligence Center