[comp.lang.modula3] Stolfi's illegal code

moss%ibis@cs.umass.edu (Eliot Moss) (12/22/90)

>>>>> On 20 Dec 1990 0940-PST (Thursday), gnelson@src.dec.COM said:

gnelson> Jorge also asks

gnelson>     Also, is it true that after the Twelve Changes I will be able to write
gnelson>     
gnelson>         INTERFACE Foo;
gnelson>           IMPORT Wr;
gnelson>           CONST Put = Wr.PutChar;
gnelson>         END Foo.
gnelson>     
gnelson>     or 
gnelson>     
gnelson>         INTERFACE Foo;
gnelson>           IMPORT Wr;
gnelson>           VAR Put: PROCEDURE (wr: Wr.T; char: CHAR) RAISES {...} := Wr.PutChar
gnelson>         END Foo.
gnelson>     
gnelson>     but not
gnelson>     
gnelson>         INTERFACE Foo;
gnelson>           IMPORT Wr;
gnelson>           PROCEDURE Put(wr: Wr.T; char: CHAR) RAISES {...};
gnelson>         END Foo.
gnelson>     
gnelson>         MODULE Foo;
gnelson>           IMPORT Wr;
gnelson>           PROCEDURE Put(wr: Wr.T; char: CHAR) RAISES {...} = Wr.PutChar;
gnelson>         BEGIN
gnelson>         END Foo.

gnelson> He is correct in all three cases.

I don't see what's wrong with the last case. Could somebody explain it,
please?

		J. Eliot B. Moss, Assistant Professor
		Department of Computer and Information Science
		Lederle Graduate Research Center
		University of Massachusetts
		Amherst, MA  01003
		(413) 545-4206; Moss@cs.umass.edu

stolfi (Jorge Stolfi) (12/23/90)

    I don't see what's wrong with the last case. Could somebody explain it,
    please?

In the implementation file, the body of "Put" is syntactically 
illegal:

    PROCEDURE Put(wr: Wr.T; char: CHAR) RAISES {...} = Wr.PutChar;

I wish the above were legal, but the body has to be a 
real body, e.g.

    PROCEDURE Put(wr: Wr.T; char: CHAR) RAISES {...} = 
      BEGIN Wr.PutChar(wr, char) END Put;

--stolfi