Re: Automated indentation

Thomas Kofler (kofler@ubilab.ubs.ch)
Wed, 18 May 1994 17:33:00 GMT

Ray Johnson (rjohnson@freedom.rdd.lmsc.lockheed.com) wrote:
: 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
[ elided ]
: >> 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.
: >
[elided]
: >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.

This is perfectly true. I am making a similar argument in a draft
proposal (not yet finished) justifying a syntax change. I am considering
a spreadsheet where you can enter Python code into the cells. A simple
if-else-statement already poses problems: It needs two lines. Second:
How to enter tabs? Maybe, the tab is used to hop from cell to cell.
Etc, etc.

: (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

----------------------------------------------------------
Thomas Kofler |Email: kofler@ubilab.ubs.ch
Union Bank of Switzerland |Tel: +41-1-236 4567
Bahnhofstr. 45 |Fax: +41-1-236 4671
CH-8021 Zurich, Switzerland |
----------------------------------------------------------