[Oberon] Oberon-07, recursion and type extension

Darren Bane dbane at SDF-EU.ORG
Wed Jul 27 22:56:03 CEST 2016


Can anyone enlighten me as to why the following doesn't work? I've been 
staring at it for a while to no avail.

I always get "incompatible parameters" errors at the recursive calls to 
Print().

MODULE Family;
   TYPE ParentDesc = RECORD END;
     Parent = POINTER TO ParentDesc;
     SonDesc = RECORD (ParentDesc) wife: Parent END;
     Son: POINTER TO SonDesc;
     DaughterDesc: RECORD (ParentDesc) husband: Parent END;
     Daughter = POINTER TO DaughterDesc;

   PROCEDURE Write(o: Parent);
   BEGIN CASE o OF
       Son: Write(o.wife) |
       Daughter: Write(o.husband)
     END
   END Write;

BEGIN
END Family.

dbane at sdfeu.org
SDF-EU Public Access UNIX System - http://sdfeu.org


More information about the Oberon mailing list