comp.lang.ada
 help / color / mirror / Atom feed
From: mbk@caffeine.engr.utk.edu (Matt Kennel)
Subject: Re: Eiffel and Java
Date: 1996/11/05
Date: 1996-11-05T00:00:00+00:00	[thread overview]
Message-ID: <55nvo4$mgk@gaia.ns.utk.edu> (raw)
In-Reply-To: 1996Nov4.140227.4601@schbbs.mot.com


David L. Shang (shang@corp.mot.com) wrote:
: In article <55ditr$pnh@gaia.ns.utk.edu> mbk@caffeine.engr.utk.edu (Matt Kennel)  
: writes:
: > David L. Shang (shang@corp.mot.com) wrote:
: > : But Sather's superclass construction is limited to non-parametrerized
: > : classes only.
: > 
: > This isn't true, at least in 1.1.  The following compiles and executes. 
: > 
: > -------------------------------------------------------
: > -- demonstrate abstract superclass over a parameterized type. 
: > -------------------------------------------------------
: > abstract class $OVER{T} > $P{T} is
: >    feature1(arg:T);
: > end;
: > 
: > abstract class $P{T} is
: >   feature1(arg:T);
: >   feature2(arg:T);
: > end; 
: > 
: > class CONCRETE{T} < $OVER{T} is
: >    feature1(arg:T) is #OUT + "In feature\n"; end;
: >    create:SAME is return new; end; 
: > end;    
: > 
: >    
: > class MAIN is
: > 	main is
: > 	  #OUT + "Hello World.\n";
: > 	  
: > 	  ob :$OVER{INT} := #CONCRETE{INT}; 
: > 	  ob.feature1(42);
: > 
: >         end;
: > end;
: > 

: Try the following, if Sather's compiler does not complain, then,
: Sather's generic class is equivalent to Transframe's:

: class MAIN is
: 	main is
: 	  #OUT + "Hello World.\n";
: 	  
: 	  ob :$OVER;
: 	  if (some_input_condition) ob := #CONCRETE{INT}; 
: 	  else ob = #P(STRING);
: 	  
: 	  // at this point, we don't know the exact element type of ob
: 	  // type assurance must be used
: 	  assume (typeof(ob).ElementType is INT) ob.feature1(42);

:         end;

I don't think the generic class concept is the same, but the following
appears to do what you desire.  The main difference is that in Sather
$TYPE{T} and $TYPE are wholly unrelated _a priori_.  $TYPE is not a superytpe
of $TYPE{T} unless explicitly declared that way, as in this example. 


---------------------
abstract class $OVER is
   -- over everything
end; 

abstract class $OVER{T} < $OVER > $P{T}  is
   feature1(arg:T);
end;

abstract class $P{T} is
  feature1(arg:T);
  feature2(arg:T);
end; 

class CONCRETE{T} < $OVER{T} is
   feature1(arg:T) is #OUT + "In feature\n"; end;
   create:SAME is return new; end; 
end;    

   
class MAIN is
   main(args:ARRAY{STR}) is
      #OUT + "Hello World.\n";
	  
      ob :$OVER;
      if args[1] = "int" then
	 #OUT + "Creating int\n";
	 ob := #CONCRETE{INT}; 
      else
	 ob := #CONCRETE{STR};
      end;
      
      typecase ob
      when $OVER{INT} then ob.feature1(42);
      else #OUT + "No matching typecase\n";
      end;
   end;
end;

-------
(~/sather1/hello) caffeine.engr.utk.edu > a.out int
Hello World.
Creating int
In feature
(~/sather1/hello) caffeine.engr.utk.edu > a.out other
Hello World.
No matching typecase
(~/sather1/hello) caffeine.engr.utk.edu >
-------


: > : Transframe provides a more powerful superclass construction that 
: > : can support parameterized classes.
: > 
: > : Suppose we have two existing classes
: > : ....
: > 
: > I believe that Sather could express the same concept. 
: > 

: The concept of generic class in Sather is different than Transframe's.

: David Shang

--
Matthew B. Kennel/mbk@caffeine.engr.utk.edu/I do not speak for ORNL, DOE or UT
Oak Ridge National Laboratory/University of Tennessee, Knoxville, TN USA/ 
  I would not, could not SAVE ON PHONE,    |==================================
  I would not, could not BUY YOUR LOAN,    |The US Government does not like
  I would not, could not MAKE MONEY FAST,  |spam either.  It is ILLEGAL!
  I would not, could not SEND NO CA$H,     |USC Title 47, section 227
  I would not, could not SEE YOUR SITE,    |p (b)(1)(C) www.law.cornell.edu/
  I would not, could not EAT VEG-I-MITE,   | /uscode/47/227.html
  I do *not* *like* GREEN CARDS AND SPAM!  |==================================
               M A D - I - A M!





  reply	other threads:[~1996-11-05  0:00 UTC|newest]

Thread overview: 168+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-10-27  0:00 Eiffel and Java Vincent WEBER
1996-10-27  0:00 ` Jean-Michel P. Decombe
1996-10-28  0:00   ` David Hanley
1996-10-28  0:00     ` Matt Kennel
1996-10-28  0:00   ` Alexandre Oliva
1996-10-28  0:00   ` Robert Dewar
1996-10-31  0:00     ` Doug Marker
1996-10-29  0:00   ` Chris Trimble
1996-10-31  0:00     ` Doug Marker
1996-10-31  0:00   ` David Bennett
1996-10-28  0:00 ` Matthew Heaney
1996-10-29  0:00   ` Vincent WEBER
1996-10-31  0:00     ` James McKim
1996-11-01  0:00       ` Matthew Heaney
1996-11-04  0:00         ` James McKim
1996-10-30  0:00   ` Jon S Anthony
1996-11-01  0:00     ` Eiffel and Java + Ada dispatching Jean-Marc Jezequel
1996-10-30  0:00   ` Eiffel and Java Don Harrison
1996-10-31  0:00     ` James McKim
1996-11-04  0:00       ` Don Harrison
1996-11-23  0:00       ` Van Snyder
1996-10-31  0:00   ` Joachim Durchholz
1996-11-01  0:00   ` Norman H. Cohen
1996-11-02  0:00   ` Eiffel and Java + Ada dispatching Jon S Anthony
1996-11-02  0:00   ` Eiffel and Java Jon S Anthony
1996-11-03  0:00   ` Joachim Durchholz
1996-11-05  0:00   ` Norman H. Cohen
1996-10-28  0:00 ` Larry Kilgallen
1996-10-30  0:00   ` Ronald Cole
1996-10-29  0:00 ` Don Harrison
1996-10-29  0:00   ` Eiffel and Java + Ada dispatching Vincent WEBER
1996-10-30  0:00     ` Jean-Marc Jezequel
1996-11-01  0:00       ` Don Harrison
1996-11-01  0:00       ` Joachim Durchholz
1996-10-30  0:00     ` Don Harrison
1996-10-30  0:00       ` Jon S Anthony
1996-10-29  0:00   ` Eiffel and Java Fergus Henderson
1996-10-30  0:00     ` Don Harrison
1996-10-30  0:00       ` Fergus Henderson
1996-10-31  0:00     ` David L. Shang
1996-11-01  0:00       ` Matt Kennel
1996-11-04  0:00         ` David L. Shang
1996-11-05  0:00           ` Matt Kennel [this message]
1996-11-06  0:00             ` David L. Shang
1996-11-04  0:00       ` Robert I. Eachus
1996-11-01  0:00     ` Jon S Anthony
1996-11-02  0:00       ` Fergus Henderson
1996-11-04  0:00       ` David L. Shang
1996-11-05  0:00         ` Jon S Anthony
1996-11-02  0:00     ` Darko BUDOR
1996-11-02  0:00       ` Fergus Henderson
1996-11-03  0:00         ` Matt Kennel
1996-11-03  0:00         ` Darko BUDOR
1996-11-03  0:00     ` Jon S Anthony
1996-11-03  0:00     ` Matthias Ernst
1996-11-05  0:00     ` Jon S Anthony
1996-11-10  0:00     ` Marcos F. F. de Macedo
1996-11-11  0:00       ` David L. Shang
1996-11-12  0:00         ` Fergus Henderson
1996-11-12  0:00           ` David L. Shang
1996-11-12  0:00             ` David L. Shang
1996-11-16  0:00             ` Fergus Henderson
1996-11-18  0:00               ` David L. Shang
1996-11-18  0:00             ` Kai Quale
1996-11-18  0:00               ` David L. Shang
1996-11-25  0:00                 ` Kai Quale
1996-11-15  0:00         ` Paul Johnson
1996-11-12  0:00       ` Alexander Asteroth
1996-11-11  0:00         ` Marcos F. F. de Macedo
1996-11-12  0:00         ` Benedict A. Gomes
1996-11-12  0:00         ` Matt Kennel
1996-10-30  0:00   ` David Petrie Stoutamire
1996-10-30  0:00   ` Eiffel and Java + Ada dispatching Jon S Anthony
1996-11-04  0:00     ` Don Harrison
1996-11-04  0:00       ` C to Ada Ali Mirhosseini
1996-11-04  0:00         ` Robert Dewar
1996-11-04  0:00         ` Matthew Daniel
1996-11-05  0:00       ` Eiffel and Java + Ada dispatching Jon S Anthony
1996-11-05  0:00         ` Don Harrison
1996-11-06  0:00           ` Jon S Anthony
1996-10-30  0:00   ` Robert I. Eachus
1996-10-31  0:00   ` Joachim Durchholz
1996-10-31  0:00   ` Jon S Anthony
1996-11-01  0:00     ` Jean-Marc Jezequel
     [not found]     ` <E06F2B.Az7@syd.csa.com.au>
1996-11-01  0:00       ` Jon S Anthony
1996-11-04  0:00         ` Don Harrison
1996-11-05  0:00           ` Jon S Anthony
1996-11-02  0:00       ` Robert Dewar
1996-11-04  0:00         ` Norman H. Cohen
1996-11-05  0:00         ` Don Harrison
1996-11-05  0:00           ` Joachim Durchholz
1996-11-05  0:00           ` Robb Nebbe
1996-11-06  0:00             ` Jean-Marc Jezequel
1996-11-07  0:00               ` Robb Nebbe
1996-11-06  0:00             ` To overload or not to overload (was Eiffel and Java + Ada dispatching) Don Harrison
1996-11-06  0:00               ` Robb Nebbe
1996-11-07  0:00                 ` Don Harrison
1996-11-07  0:00                   ` Jon S Anthony
1996-11-11  0:00                     ` Don Harrison
1996-11-07  0:00                   ` Jon S Anthony
1996-11-07  0:00                   ` Juergen Schlegelmilch
1996-11-08  0:00                     ` Don Harrison
1996-11-08  0:00                       ` Don Harrison
1996-11-14  0:00                         ` Jon S Anthony
1996-11-14  0:00                     ` Jon S Anthony
1996-11-08  0:00                   ` bill.williams
1996-11-11  0:00                     ` Don Harrison
1996-11-07  0:00                 ` Norman H. Cohen
1996-11-08  0:00             ` Eiffel and Java + Ada dispatching Robert I. Eachus
1996-11-06  0:00           ` Robert I. Eachus
1996-11-08  0:00             ` Don Harrison
1996-11-08  0:00               ` Robert A Duff
1996-11-12  0:00                 ` Don Harrison
1996-11-12  0:00                   ` Robert A Duff
1996-11-13  0:00                     ` Don Harrison
1996-11-13  0:00                       ` Jon S Anthony
1996-11-15  0:00                         ` Don Harrison
1996-11-19  0:00                           ` Jon S Anthony
1996-11-20  0:00                             ` Don Harrison
1996-11-13  0:00                       ` Robert A Duff
1996-11-14  0:00                         ` Don Harrison
1996-11-12  0:00                   ` Joachim Durchholz
1996-11-15  0:00                     ` Richard Riehle
1996-11-16  0:00                     ` Interfacing contracts (Was: Eiffel and Java + Ada dispatching) Geert Bosch
1996-11-17  0:00                       ` Robert A Duff
1996-11-08  0:00               ` Eiffel and Java + Ada dispatching Jon S Anthony
1996-11-14  0:00               ` Robert I. Eachus
1996-11-14  0:00                 ` Robert A Duff
1996-11-15  0:00                 ` Don Harrison
1996-11-15  0:00                   ` Robert I. Eachus
1996-11-19  0:00                     ` Don Harrison
1996-11-18  0:00                       ` Vincent Celier
1996-11-22  0:00                         ` Don Harrison
1996-11-19  0:00                 ` Jon S Anthony
1996-11-15  0:00               ` portmanteau (was Re: Eiffel and Java + Ada dispatching) Robert I. Eachus
1996-11-07  0:00           ` Eiffel and Java + Ada dispatching Robb Nebbe
1996-11-07  0:00           ` Jon S Anthony
1996-11-12  0:00           ` Jon S Anthony
1996-11-01  0:00   ` Eiffel and Java Matthias Ernst
1996-11-01  0:00     ` Benedict A. Gomes
1996-11-01  0:00     ` William Clodius
1996-11-02  0:00   ` Eiffel and Java + Ada dispatching Jon S Anthony
1996-11-02  0:00   ` Jon S Anthony
1996-11-04  0:00   ` Eiffel and Java Robert I. Eachus
1996-10-30  0:00 ` Jon S Anthony
1996-11-01  0:00   ` Don Harrison
1996-11-01  0:00     ` Jon S Anthony
1996-11-07  0:00       ` Marcos F. F. de Macedo
1996-11-11  0:00         ` Ian Joyner
1996-11-12  0:00         ` Don Harrison
1996-11-13  0:00           ` Norman H. Cohen
1996-11-15  0:00             ` Don Harrison
1996-11-14  0:00           ` Jon S Anthony
1996-11-15  0:00             ` Don Harrison
1996-11-19  0:00               ` Jon S Anthony
1996-11-21  0:00                 ` Don Harrison
1996-11-12  0:00     ` Jon S Anthony
1996-10-31  0:00 ` Joachim Durchholz
1996-11-01  0:00 ` Jon S Anthony
1996-11-02  0:00 ` Jon S Anthony
1996-11-03  0:00 ` Eiffel and Java + Ada dispatching Joachim Durchholz
1996-11-04  0:00 ` Eiffel and Java Richard A. O'Keefe
  -- strict thread matches above, loose matches on Subject: below --
1996-10-28  0:00 cosc19z5@bayou.uh.edu
     [not found] ` <01bbc7f6$b1c0b7a0$LocalHost@gaijin>
1996-11-01  0:00   ` Alan Lovejoy
1996-11-01  0:00     ` Chris
1996-11-01  0:00   ` Ranjan Bagchi
1996-11-02  0:00 Ell
1996-11-02  0:00 ` traymond
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox