[net.lang.mod2] ptr^^

call@byucsa.UUCP (Rod Schiffman) (02/20/85)

> On the topic of PASCAL and MODULA-2:
> 
> 	Pascal doesn't allow declaring a "pointer to pointer to ..." directly
> 	(you need an intermediate type), but given such a thing allows you to
> 	say "object pointed to by object pointed to by ...".  I thought that
> 	Wirth had fixed this when I saw that M-2 does allow declaring a
> 	"pointer to pointer to ..." directly.  My enthusiasm was tempered when
> 	I noticed that it does NOT allow "ptr^^"; you must use a run-time
> 	temp variable.  Anybody know why the change?

I have been using Modula-2 on the Lilith for 4 years now.  Since this is the
machine that Wirth uses for his programming and both of the ETH supported
Modula-2 compilers were written on and for this machine, I would assume that
programs that both the one pass and four pass compilers compile would have to
be considered as pretty standard stuff.  Both compilers will run the following
program fragment.

MODULE testp;

  VAR
    x: POINTER TO POINTER TO POINTER TO CARDINAL;

BEGIN
  x^^^ := 7;
END testp.

There are a lot of gray areas in Modula-2. The One pass compiler will not
compile any significant program I have written using the four pass compiler,
and the four pass compiler will not compile any significant program that I
have written for the one pass compiler; however, the handling of pointer
variables is the same in both compilers.
-- 

	{ihnp4,noao,mcnc,utah-cs}!arizona!byucsa!call

mark@rtech.ARPA (Mark Wittenberg) (02/28/85)

Apparently I was reading an early copy of the language definition,
although it was Wirth's book.  I no longer have the book to check
the date -- sorry.

Thanks to all those who pointed out that M-2 does allow "ptr^^".

Mark