home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / programm / programi / adaed.lzh / Ada / Examples / test2.ada < prev    next >
Encoding:
Text File  |  1992-03-07  |  929 b   |  40 lines

  1. --This file causes a binding error which we haven't figured out yet.
  2. --The same error has popped up in other programs and seems to deal
  3. --with the handling of generics.
  4.  
  5. generic
  6.         with function one_value(x,y : integer) return float;
  7. package gene is
  8.  
  9.         procedure test(x,y : integer);
  10.  
  11. end gene;
  12.  
  13. with text_io;
  14. package body gene is
  15.  
  16.         package flt_io is new text_io.float_io(float);
  17.  
  18.         procedure test(x,y : integer) is
  19.                   u : float;
  20.         begin
  21.                 text_io.put("un essai :");
  22. --                u := one_value(x,y);
  23.                 flt_io.put(u);
  24.                 text_io.new_line;
  25.         end test;
  26.  
  27. end gene;
  28.  
  29. with gene;
  30. procedure error is
  31.           function my_value(x,y : integer) return float is
  32.           begin
  33.                 return float(x+y);
  34.           end my_value;
  35.  
  36.           package my_pkg is new gene(one_value => my_value);
  37. begin
  38.         my_pkg.test(1,5);
  39. end error;
  40.