|Re: The Basket Case|
Message #39 Posted by Valentin Albillo on 23 May 2005, 5:31 a.m.,
in response to message #38 by Raymond Del Tondo
"I think you meant your statement as a joke:-)"
Not exactly. I don't recall adding a smiley after my statement.
"Even simple BASIC programs can be relatively unreadable. I recently saw such an example in datafile, right in the middle;-). Someone tried to squish as many as possible statements into one line,
thus reducing the program size by a few bytes,
but abandonning readability totally IMHO."
I *do* notice your 'sarcastic' emoticon, which I take it to mean you're referring to some program of mine published in Datafile. If that's so, you're absolutely wrong. I do not "squish as many as possible statements into one line" to reduce *program* size but to reduce *article* size.
Datafile is a small-format publication, just 32-48 A5 pages, published every other month, so saving space is critical, in my opinion, to try and fit as many interesting articles as possible from as many contributors as possible. Were I to publish my program listings in 'pretty printing' format, with every statement on its own line, indentations and such, it would take up to 5 times more valuable space in Datafile for the same net article content. I would never hog Datafile's space that way, publishing 'pretty looking' listings at the expense of not having space for other people's routines.
As a simple example, my solution to S&SMC#9 could be published there in 4 lines, thus:
100 SUB SR(N,L) @ FOR I=MOD(L,2)+4*(L=5) TO 9 STEP 2+3*(L=5)
110 IF FLAG(I) THEN 130 ELSE M=N+I @ IF MOD(M,L) THEN 130
120 SFLAG I @ IF L<9 THEN CALL SR(10*M,L+1) @ CFLAG I ELSE DISP M*10 @ CFLAG I
130 NEXT I
or else, 'pretty formatted' this way:
100 SUB SR(N,L)
105 FOR I=MOD(L,2)+4*(L=5) TO 9 STEP 2+3*(L=5)
110 IF FLAG(I) THEN
112 GOTO 130
118 IF MOD(M,L) THEN GOTO 130
119 END IF
120 SFLAG I
122 IF L<9 THEN
123 CALL SR(10*M,L+1)
124 CFLAG I
126 DISP M*10
127 CFLAG I
128 END IF
130 NEXT I
135 END SUB
taking 5 times as much space in the page. When you've got only 32-48 small (A5) pages for everyone, every two months, hogging 400% more space is unacceptable, specially when your intended audience (Datafile readers) are *very* skilled people , used to program HP calculators, and who won't have any difficulty whatsoever understanding your listing or even formatting it to their own taste if desired.
You're a Datafile subscriptor, I take, so tell me if you'd rather have Datafile space used up to include some interesting RPL routines or else to have instead Mr. Albillo's program for the HP-71B 'pretty-printed', with no statements "squished into one line".
"Back then when I programmed the 71B in BASIC,
I even put local labels in the middle of lines,
just to save the byte or two required for the line number."
Correct me if I'm wrong, but I think that any "local label" (say "PEPE") and its correspondig GOTO (GOTO "PEPE") will waste many more bytes than the two required for the line number, right ?
"You could write a complex RPL program in one single line, too, but it could get as unreadable as said BASIC program."
I don't think you're being serious here, or else you're confusing semantic unreadability with sintactic unreadability. Any BASIC code is highly human-readable for English readers because it uses mostly English keywords with an English-like syntax. You can put evey word in a single line, or a lot of words on a line, or even supress spaces between words, yet it will still be mostly readable and understandable, say for instance:
FOR Quantity = 10 TO 20
LET Cost = Price * Quantity
PRINT Price, Quantity, Cost
or even not formatted at all
FOR Quantity = 10 TO 20 : LET Cost = Price * Quantity : PRINT Price, Quantity, Cost : NEXT Quantity
pose no understanding problems for any English reader, be he/she a BASIC programmer or not. On the other hand, RPL code such as:
<< Cucu a 1
rdPOS SUB SWAP 1 \->LIST + a 'rdPOS'
INCR rdSIZ SUB +
'rdNAME' RCL STO
is inherently very difficult to fathom, however formatted, for most everyone, including RPL programmers themselves.
So I don't think your next paragraph is to be taken seriously at all, but that's your opinion and this is *my* opinion. Let's stop here and avoid flame wars and other childish behaviour, such quasi-religious topics can't be discussed profitably and I know from experience that trying to change other people's deeply-rooted beliefs, however irrational they might be, is doomed to bitter failure.
Best regards from V.
Edited: 23 May 2005, 5:41 a.m.