🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.atari.st
Article #38936

Re: Error in PD Modula-2 compiler? Or just in my brain?

#38936
From: Jelske Kloppenburg
Date: Sat, 27 May 1989 11:40
101 lines
2646 bytes
In article <340@actisb.UUCP>, federico@actisb.UUCP (Federico Heinz) writes:
> 
>   Yesterday I was attempting to solve a quite nonsensical university
> excercise using the recently-posted PD Modula compiler for the ATARI ST,
> and I ran into the following problem:
> 
>   I was trying to define a stack handling module, basing it on a
> sigle-linked list handling module.  Thus I had
> 
>     DEFINITION MODULE Lists;
> 
>     TYPE
>       List;
> 
>     (...)
> 
>     PROCEDURE CreateList(VAR newList: List);
> 
>     (...)
> 
>     END Lists;
> 
> 
> 
> 
>     IMPLEMENTATION MODULE Stacks;
> 
>     TYPE
>       Stack = List;
> 
>     (...)
> 
>     PROCEDURE CreateStack(VAR newStack: Stack);
> 
>     VAR
>       list: List;
> 
>     BEGIN
>       CreateList(list);    (* VAR parameters must be of IDENTICAL types *)
>       newStack := list;    (* this needs only assignment compatibility  *)
>     END CreateStack;
> 
>     (...)
> 
>     END Stacks;
> 
> 
>   To my surprise, the compiler flagged an 'illegal assignment' on the
> line 'newStack := list'. ...
> ...
> ... Any suggestions?  Thanks in advance
> 

From your example I made 3 files:

1st File:

    DEFINITION MODULE Lists;

    TYPE
      List;

    PROCEDURE CreateList(VAR newList: List);

    END Lists.

2nd File:

    DEFINITION MODULE Stacks;
    FROM Lists IMPORT List;

    TYPE Stack = List;

    PROCEDURE CreateStack(VAR newStack: Stack);

    END Stacks.

3rd File:

    IMPLEMENTATION MODULE Stacks;
    FROM Lists IMPORT CreateList, List;

    PROCEDURE CreateStack(VAR newStack: Stack);

    VAR
      list: List;

    BEGIN
      CreateList(list);    (* VAR parameters must be of IDENTICAL types *)
      newStack := list;    (* this needs only assignment compatibility  *)
    END CreateStack;

    END Stacks.

I compiled these files whith the TU Muenchen Modula2 and no errors were
reported. There may be another cause for your error.

      Kloppenburg@kmx.gmd.dbp.de
UUCP: kloppen@gmdzi

                     In real life: Jelske Kloppenburg
Technical Details
Message-ID: <1091@gmdzi.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!mcvax!unido!gmdzi!kloppen
References: <340@actisb.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!mcvax!unido!gmdzi!kloppen
From: kloppen@gmdzi.UUCP (Jelske Kloppenburg)
Newsgroups: comp.sys.atari.st,comp.lang.modula2
Subject: Re: Error in PD Modula-2 compiler? Or just in my brain?
Summary: No error reported from TU Muenchen Modua2
Message-ID: <1091@gmdzi.UUCP>
Date: 27 May 89 11:40:14 GMT
References: <340@actisb.UUCP>
Distribution: comp
Organization: GMD, Sankt Augustin, F. R. Germany
Lines: 101