home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / ada / 4076 < prev    next >
Encoding:
Text File  |  1993-01-25  |  1.2 KB  |  40 lines

  1. Newsgroups: comp.lang.ada
  2. Path: sparky!uunet!paladin.american.edu!howland.reston.ans.net!spool.mu.edu!agate!linus!linus.mitre.org!linus!mbunix!emery
  3. From: emery@dr_no.mitre.org (David Emery)
  4. Subject: Re: Programs wanted
  5. In-Reply-To: pk115050@wvnvms.wvnet.edu's message of 25 Jan 93 18:03:34 EST
  6. Message-ID: <EMERY.93Jan25205737@dr_no.mitre.org>
  7. Sender: news@linus.mitre.org (News Service)
  8. Nntp-Posting-Host: dr-no.mitre.org
  9. Organization: The Mitre Corp., Bedford, MA.
  10. References: <1993Jan25.180334.4567@wvnvms.wvnet.edu>
  11. Date: Tue, 26 Jan 1993 01:57:37 GMT
  12. Lines: 26
  13.  
  14. Consider 
  15.   package P is
  16.     type I1 is new integer;
  17.     -- "+" now redefined for objects of type I1
  18.     function "+" (l :I1; r : integer) return I1;
  19.     function "+" (l: integer; r : I1)  return I1;
  20.   end P;
  21.  
  22.   with P; use P;
  23.   procedure Q is
  24.     X, Y : I1 := 1;
  25.     I, J : Integer := 2;
  26.     MAGIC_NUMBER : constant := 42;
  27.   begin
  28.     X := X + I;
  29.     X := X + 1;
  30.     X := MAGIC_NUMBER + Y;
  31.     Y := X + J;
  32.     I := integer(X) + integer(Y);
  33.   end Q;
  34.  
  35. How many unique operators are there in this code???  Almost any answer
  36. to this question involves enough semantic analysis to resolve Ada
  37. overloading.  That's a good-sized chunk of an Ada compiler.  
  38.  
  39.                 dave
  40.