Auto-indentingis available in release
19. I just auto-indented the following in the Syntax Editor:
loop something.
do if something.
compute
something.
end if.
end loop.
From:
Art Kendall <Art@DrKendall.org>
To:
SPSSX-L@LISTSERV.UGA.EDU
Date:
09/15/2010 02:58 PM
Subject:
Re: Auto indent syntax option
Sent by:
"SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
> I find the ability to visually detect the structural
and logical flow of a
> program to be an essential quality of well written code.
So do I. The very point I was trying to get at. You said it more clearly.
In FORTRAN 77 (why it was called that in 1971 since it worked in 1971 I
have no idea), a programmer could use 1or more tabs to separate the
statement number from the statement. If the programmer used too few
or
too many PRETTY would adjust the number of tabs. This was very helpful
to the user to try to compare the logic (s)he wanted and what the
machine interpreted the logic to be.
The computer world is very much more developed today. It should be
trivial for SPSS to put that kind of feature in the editor. In the
meanwhile, perhaps someone could write a PYTHON script to PRETTY the
syntax. As you said VB.Net enforces it automatically. That clearly
should be a proof of feasibility.
Art
On 9/15/2010 11:59 AM, David Marso wrote:
> Why Thank You Art,
> I find the ability to visually detect the structural and logical flow
of a
> program to be an essential quality of well written code. I have
been using
> Visual Basic since 1997 and SPSS since the mid 80's. A few months
ago I
> began porting some of my VB6 applications to VB.Net and I was absolutely
> delighted to discover that indentation of code is enforced automatically
by
> the program.
> Type the beginning clause of a structural element (For, With Select
Case ...
> and enter and it will automatically complete the structure.
> It also does this consistently for all nested elements.
> For years I used to type FOR I=blah to blah, hit Enter and Next I,
then back
> up to enter my code..
> I pretty much align everything as I go. Same with SPSS. It
takes less time
> to add these visual cues while writing the program than to try to
figure out
> whether all your LOOPS, DO IF , DO REPEAT etc are all aligned.
> When you go back to code later you can either scratch your head muttering
> WTF for half an hour or jump right in and continue where you left
off.
> David
>> David is an extremely skilled programmer and seemingly
still finds
>> the vertical alignment useful despite years of experience
as an
>> expert programmer. The editor should make
it easy to produce syntax
>> that follows good programming practices.
That way even beginners
>> can produce the readable code that communicates
to people as well as
>> to the machine.<br>
>> <br>
>> Art Kendall<br>
>>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except
the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>
=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD