Elegance is in the eye of the beholder. Yes it's shorter, and the layout 
can be modified by changing the value of L and T.
However, when code is only updated rarely, it is rather nice for that 
you can see the layout in the code. Your elegant version makes it less 
apparent, and it  has to be worked out.

This is a trivial case.

However, I once spent several hours a day  over 18 months taking 
someone's fiendishly clever (Fortran) program,  which had been made to 
live within 32K code overlays; simplifying the code, unwinding 
recursively defined statement functions etc to make the damn thing 
readable, maintainable, and extendable. (we had moved to virtual memory 
computing and the 32K limit no longer applied). I then extended it in 
all manner of ways that had not been anticipated by the original author.

 Recently I was requested to update the code  - I hadn't looked at it in 
20 Years  - I had to get it to run on a modern workstation and to output 
csv files for input into excel. It took me longer to get the backups off 
1/2 inch tape  (half a day) than it did to get it running again (an hour 
to modify the "make" file), and modify the output (a few minutes).

We couldn't readily lay our hands on a user guide, but it did not take 
long comparing archived data files with the input handler for me work it 
out and get a new user up to speed.

So, my approach is if that as far as code goes, whenever it is simple, 
understandable and it works, I would leave it alone and not be tempted 
to "improve it".

Jeremy

P Witte wrote:
> P Witte writes:
>
> <>
>   
>> Thus:
>>
>>    proc label
>>        spoolon '_par1'
>>        lprint
>>        lprint
>>        lprint
>>        lprint '                      '+name$
>>        lprint '                      '+adda$
>>        lprint '                      '+addb$
>>        lprint '                      '+addc$
>>        lprint
>>        lprint
>>        lprint chr(12)
>>        spooloff
>>    endproc
>>     
>
> or slightly more elegantly:
>
>    proc label
>         local L, T
>         let L = 2: let T = 22
>        spoolon '_par1'
>        lprint rept(chr(10), L): rem L + 1 linefeeds
>        lprint tab T; name$
>        lprint tab T; adda$
>        lprint tab T; addb$
>        lprint tab T; addc$
>        lprint chr(12)
>        spooloff
>    endproc
>
> Per
> _______________________________________________
> QL-Users Mailing List
> http://www.q-v-d.demon.co.uk/smsqe.htm
>
>
>   


_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm

Reply via email to