--* From SMWATT%WATSON.vnet.ibm.com@yktvmv.watson.ibm.com Tue Aug 30 16:43:07 1994 --* Received: from yktvmv-ob.watson.ibm.com by asharp.watson.ibm.com (AIX 3.2/UCB 5.64/930311) --* id AA16864; Tue, 30 Aug 1994 16:43:07 -0400 --* Received: from watson.vnet.ibm.com by yktvmv.watson.ibm.com (IBM VM SMTP V2R3) --* with BSMTP id 0727; Tue, 30 Aug 94 16:43:12 EDT --* Received: from YKTVMV by watson.vnet.ibm.com with "VAGENT.V1.0" --* id --* for asbugs@watson; Tue, 30 Aug 94 16:43:12 -0400 --* Received: from YKTVMV by watson.vnet.ibm.com with "VAGENT.V1.0" --* id 0277; Tue, 30 Aug 1994 16:43:11 EDT --* Received: from spadserv.watson.ibm.com by yktvmv.watson.ibm.com --* (IBM VM SMTP V2R3) with TCP; Tue, 30 Aug 94 16:43:10 EDT --* Received: by spadserv.watson.ibm.com (AIX 3.2/UCB 5.64/900524) --* id AA31367; Tue, 30 Aug 1994 16:43:27 -0400 --* Date: Tue, 30 Aug 1994 16:43:27 -0400 --* From: smwatt@spadserv.watson.ibm.com (Stephen Watt) --* X-External-Networks: yes --* Message-Id: <9408302043.AA31367@spadserv.watson.ibm.com> --* To: asbugs@watson.ibm.com --* Subject: [2][tinfer] extends not seeing the operations from the extendee --@ Fixed by: SSD Mon Jan 30 13:29:58 EST 1995 --@ Tested by: none --@ Summary: Type inference fixes for parameterized extends. -- Command line: ashapr sizable.as -- Version: 0.36.5 -- Original bug file name: sizable.as #include "aslib" +++ ``Sizable'' provides a crude estimate of memory use. define Sizable: Category == with { sizeEstimate: % -> SingleInteger; } extend Boolean: Sizable == add { sizeEstimate(a: %): SingleInteger == 1 } extend SingleInteger: Sizable == add { sizeEstimate(n: %): SingleInteger == 1 } extend Integer: Sizable == add { sizeEstimate(n: %): SingleInteger == length n quo 32 } extend List(S: Sizable): Sizable == add { sizeEstimate(l: %): SingleInteger == { sz := 0; for s in l repeat sz := sz + sizeEstimate s + 2; } } #if TEST import from List Integer; print << sizeEstimate 12341234123412341234 << newline; print << sizeEstimate [1,2,3,4,5,6,12341234123412341234] << newline; #endif --+ --* From SMWATT%WATSON.vnet.ibm.com@yktvmv.watson.ibm.com Tue Aug 30 16:43:07 1994 --+ --* Received: from yktvmv-ob.watson.ibm.com by asharp.watson.ibm.com (AIX 3.2/UCB 5.64/930311) --+ --* id AA16864; Tue, 30 Aug 1994 16:43:07 -0400 --+ --* Received: from watson.vnet.ibm.com by yktvmv.watson.ibm.com (IBM VM SMTP V2R3) --+ --* with BSMTP id 0727; Tue, 30 Aug 94 16:43:12 EDT --+ --* Received: from YKTVMV by watson.vnet.ibm.com with "VAGENT.V1.0" --+ --* id --+ --* for asbugs@watson; Tue, 30 Aug 94 16:43:12 -0400 --+ --* Received: from YKTVMV by watson.vnet.ibm.com with "VAGENT.V1.0" --+ --* id 0277; Tue, 30 Aug 1994 16:43:11 EDT --+ --* Received: from spadserv.watson.ibm.com by yktvmv.watson.ibm.com --+ --* (IBM VM SMTP V2R3) with TCP; Tue, 30 Aug 94 16:43:10 EDT --+ --* Received: by spadserv.watson.ibm.com (AIX 3.2/UCB 5.64/900524) --+ --* id AA31367; Tue, 30 Aug 1994 16:43:27 -0400 --+ --* Date: Tue, 30 Aug 1994 16:43:27 -0400 --+ --* From: smwatt@spadserv.watson.ibm.com (Stephen Watt) --+ --* X-External-Networks: yes --+ --* Message-Id: <9408302043.AA31367@spadserv.watson.ibm.com> --+ --* To: asbugs@watson.ibm.com --+ --* Subject: [2][tinfer] extends not seeing the operations from the extendee --+ --+ --@ Fixed by: --+ --@ Tested by: --+ --@ Summary: --+ --+ --+ -- Command line: ashapr sizable.as --+ -- Version: 0.36.5 --+ -- Original bug file name: sizable.as --+ --+ #include "aslib" --+ --+ +++ ``Sizable'' provides a crude estimate of memory use. --+ define Sizable: Category == with { --+ sizeEstimate: % -> SingleInteger; --+ } --+ --+ extend Boolean: Sizable == add { --+ sizeEstimate(a: %): SingleInteger == 1 --+ } --+ --+ extend SingleInteger: Sizable == add { --+ sizeEstimate(n: %): SingleInteger == 1 --+ } --+ --+ extend Integer: Sizable == add { --+ sizeEstimate(n: %): SingleInteger == length n quo 32 --+ } --+ --+ extend List(S: Sizable): Sizable == add { --+ --!! 'import from S' needed to get sizeEstimate$S. --+ import from S; --+ --+ sizeEstimate(l: %): SingleInteger == { --+ sz := 0; --+ for s in l repeat sz := sz + sizeEstimate s + 2; --+ --!! A value is needed here. --+ sz; --+ } --+ } --+ --+ #if TEST --+ --+ --!! At the moment we cannot extend and import in the same scope. --+ f () : () == { --+ --+ --!! Need to import the SingleInteger printing function. --+ import { --+ <<: (TextWriter, %) -> TextWriter; --+ } from SingleInteger; --+ --+ import from List Integer; --+ --+ print << sizeEstimate 12341234123412341234 << newline; --+ print << sizeEstimate [1,2,3,4,5,6,12341234123412341234] << newline; --+ --+ } --+ --+ f(); --+ --+ #endif