From: Michael J. Mahon on
Paul Schlyter wrote:
> In article <4481749f$0$15787$14726298(a)news.sunsite.dk>,
> Kent Friis <nospam(a)nospam.invalid> wrote:
>
>
>>Den Fri, 02 Jun 2006 21:53:25 -0700 skrev Michael J. Mahon:
>>
>>
>>>Many years later, I think that the "offside rule" for delimiting
>>>blocks simply by indentation is a very nice approach. Why on
>>>earth should white space, the most significant characteristic of
>>>text to the human eye, be ignored by most programming languages?
>>
>>For the same reason that comments, the most human readable text found
>>in a program, are ignored by the programming language. Whitespace is
>>an important part of making the program more readable.
>>
>>A programming language that prevents me to use white space to make
>>code readable (because that would change what the code does) is just
>>as bad as one that prevents me from writing a comment where needed
>>(Actually, Visual Basic .NET does that in certain places. Yuck).
>
>
> Check out Python - there indentation delimits if blocks. And I cannot
> se any reason why:
>
> if condition
> statement1
> statement2
> else
> statement3
> statement4
> rest_of_program
>
> is more readable than:
>
> if condition
> statement1
> statement2
> else
> statement3
> statement4
> rest_of_program
>
> :-)

Actually, the first statement includes the <rest_of_program> in the
else clause, since there is no delimiter. That difference is made clear
in the second (off-side delimited) expression.

I'm glad to hear that it has been adopted in a popular language. ;-)

-michael

Parallel computing for 8-bit Apple II's!
Home page: http://members.aol.com/MJMahon/

"The wastebasket is our most important design
tool--and it is seriously underused."
From: Michael J. Mahon on
Kent Friis wrote:
> ["Followup-To:" header set to comp.sys.cbm.]
> Den Sat, 03 Jun 2006 12:42:56 GMT skrev Paul Schlyter:
>
>>In article <4481749f$0$15787$14726298(a)news.sunsite.dk>,
>>Kent Friis <nospam(a)nospam.invalid> wrote:
>>
>>
>>>Den Fri, 02 Jun 2006 21:53:25 -0700 skrev Michael J. Mahon:
>>>
>>>
>>>>Many years later, I think that the "offside rule" for delimiting
>>>>blocks simply by indentation is a very nice approach. Why on
>>>>earth should white space, the most significant characteristic of
>>>>text to the human eye, be ignored by most programming languages?
>>>
>>>For the same reason that comments, the most human readable text found
>>>in a program, are ignored by the programming language. Whitespace is
>>>an important part of making the program more readable.
>>>
>>>A programming language that prevents me to use white space to make
>>>code readable (because that would change what the code does) is just
>>>as bad as one that prevents me from writing a comment where needed
>>>(Actually, Visual Basic .NET does that in certain places. Yuck).
>>
>>Check out Python - there indentation delimits if blocks. And I cannot
>>se any reason why:
>>
>> if condition
>> statement1
>> statement2
>> else
>> statement3
>> statement4
>> rest_of_program
>>
>>is more readable than:
>>
>> if condition
>> statement1
>> statement2
>> else
>> statement3
>> statement4
>> rest_of_program
>>
>>:-)
>
>
> For the same reason that /* aadkfjghaldfjghsdklfgjhasdklguaadfkghj */
> is better than being unable to write a comment: Both are stupid examples
> of using a thing meant for making things easier for the exact opposite
> cause.
>
> Now try to imagine that someone wants to indent code to actually make
> it *more readable*, just like someone writing comments to actually
> explain what's going on. Then you might see the point.

Again, I see no problem. The "user indented" code should parse
fine, as long as the statements don't come left of the brackets.

BTW, I also think that 50 lines is a good upper limit for a
procedure, with the only exception being a CASE statement.
(And note that newline and formfeed are fine whitespace characters
and will be interpreted as such wherever spaces could occur.)

-michael

Parallel computing for 8-bit Apple II's!
Home page: http://members.aol.com/MJMahon/

"The wastebasket is our most important design
tool--and it is seriously underused."
From: Michael J. Mahon on
mdj wrote:
> Michael J. Mahon wrote:
>
>
>>Many years later, I think that the "offside rule" for delimiting
>>blocks simply by indentation is a very nice approach. Why on
>>earth should white space, the most significant characteristic of
>>text to the human eye, be ignored by most programming languages?
>
>
> Once you bed down the definition of white space, you've committed the
> language to a certain aesthetic form quite unnecessarily. People have
> been arguing for *years* over such aestheic issues in most programming
> languages without any clear consensus. Perhaps one day we'll reach one,
> but beauty being in the eye of the beholder I somewhat doubt it :-)

It isn't about beauty--it's about clarity. And there are *huge*
payoffs in adopting a standard format for programs--as, indeed,
most serious projects do.

Not everyone likes to spell words the same way, either, but we
don't care what they think--the convention is king.

With proper rules, a program's beauty when expressed in a language
is *precisely* its evident function.

BTW, programmers shouldn't choose names they "like", either. Naming
should all be within a simple, rigid framework, so that the semantics
of any name are expressed by the identifier.

The lack of widespread adoption of such a convention is a measure of
the immaturity of programming as a discipline.

> An interesting language in this regard is Ruby, who's syntax is such
> that BOTH whitespace or statement delimiters may be used, depending on
> what is felt most appropriate to the developer.

Most "offside" languages also permit explicit brackets. They are
especially handy in rendering short lists horizontally, like argument
lists or short conditionals.

> Actually the first language I've used seriously where carriage returns
> are considered statement terminators and I've not immediately disliked
> the language. In fact, Ruby allows some beautifully concise code. The
> language is so flexible in fact, that you can override almost any facet
> of it, in effect making it very simple to construct domain-specific
> languages, or sublanguages, to better suit the problem domain. Lots of
> fun.

Sounds interesting--I'll take a look at Ruby.

-michael

Parallel computing for 8-bit Apple II's!
Home page: http://members.aol.com/MJMahon/

"The wastebasket is our most important design
tool--and it is seriously underused."
From: Michael J. Mahon on
Paul Schlyter wrote:
> In article <44809520$0$11067$9b4e6d93(a)newsread4.arcor-online.net>,
> Linards Ticmanis <ticmanis(a)gmx.de> wrote:
>
>
>>Michael J. Mahon wrote:
>>
>>
>>>Actually, I believe that _pragma_ was borrowed from Algol 68,
>>>which must be the most influential least implemented language. ;-)
>>
>>As they say, Algol was a great improvement on its successors. ;-)
>
>
> Algo was a great programming language -- as long as your program
> didn't have to du any input or any output. Not having to actually
> implement your program was also a clear advantage, considering the
> scarcity of Algol compilers.... therefore, Algol was for a long time
> used in textbooks as examples of implementing various algorithms.

There was a great (I/O extended) one-and-a-half pass Algol 58 compiler
on the last commercial vacuum tube machine, the Burroughs 220. It was
a compile-and-go system designed for teaching, but it was both a fast
and an efficient compiler for the time. It was written entirely in
assembly language, and was the first example of a _virtuoso_ program
I ever saw--and marvelled at. ;-)

-michael

Parallel computing for 8-bit Apple II's!
Home page: http://members.aol.com/MJMahon/

"The wastebasket is our most important design
tool--and it is seriously underused."
From: Michael J. Mahon on
mdj wrote:
> Paul Schlyter wrote:

<snip>

>>I dondt think one can talk about namespaces at all regarding macros in
>>preprocessors. The preprocessor does not know what a namespace is. It
>>hardly knows anything about the underlying source language. Heck, you
>>can even replace reserved words with macros -- try to do THAT using
>>the global namespace in a normal way.....
>
>
> Why? Namespaces are a natural extension present in most modern
> languages to avoid collisions that occur frequently in larger programs.
> Macro's being redefined by included headers from an unrelated piece of
> code is a real problem in C/C++ programs.
>
> Of course, most good programmers utilise some form of poor-mans
> namespacing by prefixing their preprocessor names with something that's
> likely to be unique. This illustrates the point that the feature would
> be useful.

In the "olden days", assemblers frequently had HEAD "x" pseudo ops that
would treat all identifiers encountered from then on as if they had an
"x" prefixed to them, until the next HEAD operation.

This didn't produce any visible change in the labels, but it did serve
to create "local" scopes if the HEAD characters were well chosen.

-michael

Parallel computing for 8-bit Apple II's!
Home page: http://members.aol.com/MJMahon/

"The wastebasket is our most important design
tool--and it is seriously underused."