--* From postmaster%watson.vnet.ibm.com@yktvmv.watson.ibm.com  Thu Nov  3 16:27:34 1994
--* Received: from yktvmv-ob.watson.ibm.com by asharp.watson.ibm.com (AIX 3.2/UCB 5.64/930311)
--*           id AA16143; Thu, 3 Nov 1994 16:27:34 -0500
--* Received: from watson.vnet.ibm.com by yktvmv.watson.ibm.com (IBM VM SMTP V2R3)
--*    with BSMTP id 4579; Thu, 03 Nov 94 16:27:39 EST
--* Received: from YKTVMV by watson.vnet.ibm.com with "VAGENT.V1.0"
--*           id <A.HEMMECKE.NOTE.YKTVMV.1059.Nov.03.16:27:38.-0500>
--*           for asbugs@watson; Thu, 03 Nov 94 16:27:39 -0500
--* Received: from server1.rz.uni-leipzig.de by watson.ibm.com (IBM VM SMTP V2R3)
--*    with TCP; Thu, 03 Nov 94 16:27:31 EST
--* Received: from aix550.informatik.uni-leipzig.de by server1.rz.uni-leipzig.de with SMTP
--* 	(1.38.193.5/15.6) id AA16030; Thu, 3 Nov 1994 22:27:06 +0100
--* Received: by aix550.informatik.uni-leipzig.de (AIX 3.2/UCB 5.64/BelWue-1.1AIXRS)
--*           id AA23885; Thu, 3 Nov 1994 22:26:44 +0100
--* Date: Thu, 3 Nov 1994 22:26:44 +0100
--* From: hemmecke@aix550.informatik.uni-leipzig.de (Ralf Hemmecke)
--* Message-Id: <9411032126.AA23885@aix550.informatik.uni-leipzig.de>
--* To: asbugs@watson.ibm.com
--* Subject: [5] problems in using "default"

--@ Fixed  by:  SSD   Mon Jan 30 13:38:22 EST 1995 
--@ Tested by:  none 
--@ Summary:    Fixed the type inference of category constructors in the presence of default declarations for the types of the parameters. 

-- Command line: asharp -DC1 xxx.as
-- Version: A# version 0.36.5 for AIX RS/6000
-- Original bug file name: xxx.as

-- Author: Ralf Hemmecke, University of Leipzig
-- Date: 03-NOV-94
-- A# version 0.36.5 for AIX RS/6000

-- What is wrong with "default R:BT;"?
-- Compiling this code via
--      asharp -DC1 xxx.as
-- gives the error message

--:"xxx.as", line 24:   extend D(R,E:BT):Cat(R,E,E) == add {
--:                   .................................^
--:[L24 C34] #1 (Error) The domain is missing some exports.
--:        Missing leadingTerm: % -> T

-- whereas
--      asharp -DC2 xxx.as
-- compiles without any message.

-- The only differences of versions C1 and C2 are marked with "--!!".
-- C1 uses "default" while C2 does not.
-------------------------------------------------------------------
#include "aslib.as"

macro BT == BasicType;

#if C1
  default R:BT;                                                --!!
  -----------------------------------------------------------------
  D(R,E:BT): BT;                                               --!!
  == add {
    Monomial ==> Record(term:E);
    Rep ==> List Monomial; -- polynomial
    import from Rep,Monomial;
    (p:TextWriter) << (x:%):TextWriter == p;
    (x:%)=(y:%):Boolean == true;
    sample:% == per empty();
    degree(x:%):E == (first rep x).term;
  }
  -----------------------------------------------------------------
  Cat(R,E:BT,T:BT): Category == with {                         --!!
    leadingTerm: % -> T;
  }
  -----------------------------------------------------------------
  extend D(R,E:BT): Cat(R,E,E) == add {                        --!!
    leadingTerm(x:%):E == sample;
  }
  -----------------------------------------------------------------
#elseif C2
  -----------------------------------------------------------------
  D(R:BT,E:BT): BT;                                            --!!
  == add {
    Monomial ==> Record(term:E);
    Rep ==> List Monomial; -- polynomial
    import from Rep,Monomial;
    (p:TextWriter) << (x:%):TextWriter == p;
    (x:%)=(y:%):Boolean == true;
    sample:% == per empty();
    degree(x:%):E == (first rep x).term;
  }
  -----------------------------------------------------------------
  Cat(R:BT,E:BT,T:BT): Category == with {                      --!!
    leadingTerm: % -> T;
  }
  -----------------------------------------------------------------
  extend D(R:BT,E:BT): Cat(R,E,E) == add {                     --!!
    leadingTerm(x:%):E == sample;
  }
  -----------------------------------------------------------------
#endif
 
