[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Packages: where is the beef ?
In article <9209041600.AA08994@peoplesparc.Berkeley.EDU> fateman@PEOPLESPARC.BERKELEY.EDU (Richard Fateman) writes:
I think you would find similar problems in other languages if
you attempt to redefine built-in functions.
Not necessarily. Consider the following piece of Ada-code:
with TEXT_IO;
package MY_PACKAGE is
LINE_NUMBER : integer := 1;
procedure PUT_LINE(S:in string);
end;
package body MY_PACKAGE is
procedure PUT_LINE(S:in string) is
begin
TEXT_IO.PUT(integer'image(LINE_NUMBER) & ": ");
TEXT_IO.PUT_LINE (S);
LINE_NUMBER := LINE_NUMBER + 1;
end;
end;
with TEXT_IO, MY_PACKAGE;
procedure MAIN is
begin
MY_PACKAGE.PUT_LINE("foo");
MY_PACKAGE.PUT_LINE("foo");
MY_PACKAGE.PUT_LINE("foo");
TEXT_IO.PUT_LINE("foo");
TEXT_IO.PUT_LINE("foo");
TEXT_IO.PUT_LINE("foo");
end;
--
% This article represents my personal views.
% Kari Systa, Tampere Univ. Technology, Box 553, 33101 Tampere, Finland
% work: +358 31 162585 fax: +358 31 162913 home: +358 31 177412
% Internet: ks@cs.tut.fi X.400: C=fi ADMD=fumail O=TUT OU=CS S=ks
--