From: neeri@iis.ethz.ch (Matthias Neeracher)
Subject: Re: The need for an assembler (was: Favorite CPU)
Organization: Integrated Systems Laboratory, ETH, Zurich
	<1992Aug26.073312.15322@news.columbia.edu>
	<NEERI.92Aug26154345@iis.ethz.ch>
	<1992Aug27.075325.16635@news.columbia.edu>
Date: Thu, 27 Aug 1992 17:00:26 GMT

In article <1992Aug27.075325.16635@news.columbia.edu> lasner@watsun.cc.columbia.edu (Charles Lasner) writes:
>In article <NEERI.92Aug26154345@iis.ethz.ch> neeri@iis.ethz.ch (Matthias Neeracher) writes:
>>
>>>The test for the condition is 
>>>whether it's possible to transfer out of a loop, and then go back in with
>>>out losing any context,
>>
>>This is clearly illegal in Pascal.
>
>You left out the other half of the test, which was to stay within a larger
>loop structure surrounding the exited loop without loss.

And this is clearly *legal*.

>The point of the matter is that by making it illegal, you limit the ability to
>create straight-forward structures without resorting to "equivalent" forms
>that sometimes aren't so equivalent.

Jumping out of a loop and back in again is straight-forward ? Show me an
algorithm where the straight-forward solution consists of jumping out and into
a loop.

>By declaring it illegal, you allow the
>compiler to "cop out" regarding stack marking, etc., so a sloppier code
>generation is acceptable.

Making the compiler's job easier is only part of the reason (do I understand
you correctly that you resent this restriction *because* it allows the compiler
to generate efficient code ?). Another important reason is predictability. The
only HLLs I know that allow jumping back into loops are Fortran and some BASIC
dialects (I don't know PL/I, nor do I have a real desire to know). The BASIC
solution leaves the stack in a mess, while Fortran merely leaves the
Programmer's mind in a mess. In neither language have I seen a convincing
reason to allow jumping into loops. 

>Further, this encourages the use of problematic conditions with "side effects".
>If a statement is formed out of a while condition that is the conjunction of
>two expressions .AND.ed together, and one of them is clearly already 
>calculated as false, do you waste time executing the other expression?  Or,
>are you bound to executing it because you can't specify whether the side
>effects possibly created by this execution are even important?

This is admittedly a weakness of Pascal, where the behavior was originally not
specified. One more reason to use C :-)

>>>Why do I want a language where I have to help the compiler out by using
>>>odd syntax for labels?
>>
>>Funny, you never seem to complain about numerical labels in Fortran.
>
>[...] I prefer to take this argument to be PASCAL versus PL/I.  In PL/I
>the functions are recursive or not as I choose,

Why should a programmer have to specify that a function is recursive? That's
what compilers are for.

>Globality of variables is
>determined by my usage, not by arbitrary wimpy restrictions of the compiler,

*Shudder*. How exactly does this work ?

>and all labels are equally symbolic.

I can have symbolic labels in C, too.

>>>Why would I want to use a language where you need
>>>FORWARD statements because it doesn't do enough passes to do it without me?
>>
>>Why slow the compiler down for programmers who wouldn't use the language
>>anyway :-)
>
>A silly remark that doesn't answer the question.
>This is a major ugly
>feature of the language: all internal procedures have to come first, and
>when they reference each other, a kludge is needed to pull it off.

One reason for this is that if the rest of the language can be compiled in a
single pass, the incentive to add a whole compiler pass for this minor problem
is not that great (Interestingly, the original compiler for Modula-2 was a
4 or 5 pass compiler, and Modula-2 didn't have forward declarations. When the
compiler was rewritten as a one pass compiler, forward declarations returned).

Another resaon for forward declarations is that it faciliates a sequential
reading of the code.

>An
>additional minor peeve: when the arg list for the function that was
>forwarded is now known, why must it be left out of the definition.  I
>have seen comments that attempt to fantasize about the repetition of the
>arg list, but why do you have to leave it out?

The reason is probably simple and ugly: Because it would cost time for the
compiler to check the arguments and it would be dangerous for maintenance to
leave them unchecked. Modula-2 has repetition of the argument lists in the
definition and implementation modules, and several compilers don't check
whether the arguments have the same names, so you might end up with a
declaration:

PROCEDURE DrawRect(length: INTEGER; width: INTEGER);

and an implementation:

PROCEDURE DrawRect(width: INTEGER; length: INTEGER);

>>>I have used much "smarter" assemblers than PASCAL's :-).
>
>What I mean is that assemblers will do multiple passed for me, why can't
>compilers?  Seems to beg the question of just what is "high" level?

As you mentioned in another post, there are different heights of levels. you
might just as well complain that Pascal doesn't do garbage collection and that
procedures are not first class objects.

>>>(Indeed
>>>poorly-formed GOTOs could be harmful.)
>>
>>And lots of well formed GOTOs unnecessary in modern languages.
>
>[...]  And unnecessary isn't a
>replacement for undesirable.  Why have a language that limits my ability
>to express ideas in alternate ways?

A programming language that allows too many ways to express the same idea is
likely to produce "sublanguages", i.e., Programmers use exclusively a subset of
the language and different programmers use different subsets.

>BTW, if HLL theory is that it abstracts what computers actually do,
>then why the deficiency in so many languages regarding goto?  Do people
>believe that computers lack program control branch instructions?

No, but they believe that it's useful to abstract from them. A majority of
computers today seem to also have a condition code, but that doesn't
necessarily mean that its a good idea to create a programming language that
allows the following:

begin
   compare b to c;
   BMI negative;

   d := 2;

negative:
end;

(*If*, however, somebody indeed creates a programming language which has a
compare statement, I suggest that Motorola 68000 semantics for compare :-)

Matthias

-----
Matthias Neeracher                                      neeri@iis.ethz.ch
  "And that's why I am going to turn this world upside down, and make
   of it a fire so *bright* that someone real will notice"
                                -- Vernor Vinge, _Tatja Grimm's World_
Newsgroups: alt.folklore.computers