One of t h e s i g n i f i c a n t c o n t r i b u t i o n s of t h e o b j e c t o r i e n t e d (OO) p a r a d i g m of p r o g r a m m i n g was to s h o w t h a t f u n c t i o n s wh ich a r e p o l y m o r p h i c in t h e i r f i r s t a r g u m e n t o n l y can be u s e d to s impl i fy t h e s t r u c t u r e o f p r o g r a m s . F u n c t i o n s t h a t would be c o d e d a s l a r g e c a s e s t a t e m e n t s in c o n v e n t i o n a l l a n g u a g e s a r e d i s t r i b u t e d o v e r c l a s s e s , wi th a c o n s e q u e n t i m p r o v e m e n t in t h e s t r u c t u r e o f t h e p r o g r a m . A f u n c t i o n s u c h a s a rea , f o r example , is d i s t r i b u t e d o v e r c l a s s e s s u c h a s RectanKle, Circle, and so on , r a t h e r t h a n b e i n g w r i t t e n as a l a r g e c a s e s t a t e m e n t wi th one c l a u s e fo r e a c h s h a p e . All o f t he c o d e r e l a t e d to a p a r t i c u l a r s h a p e is i n c l u d e d in t h e c l a s s fo r t h a t s h a p e . At f i r s t s i g h t , it s e e m s t h a t t he OO p a r a d i g m c a n n o t he lp u s in c o d i n g f u n c t i o n s w h i c h a r e p o l y m o r p h i c in s e v e r a l a r g u m e n t s . As I n g a l l s has s h o w n , h o w e v e r , we can d i s p a t c h a s e c o n d m e s s a g e to the c l a s s o f the s e c o n d a r g u m e n t , a n d so on, t h u s r e t a i n i n g t he a d v a n t a g e s o f OO s t y l e [ Inga l l s86] , a l b e i t a t t he e x p e n s e of many small me thods . Our r e s e a r c h g r o u p , l ike s e v e r a l o t h e r s w o r k i n g in t h i s a r e a [ S c h a f f e r t 8 6 , Black87, Meyer88] , is d e v e l o p i n g a s t a t i c a l l y t y p e d O0 l a n g u a g e . The compi le r o f a t y p e d 0 0 l a n g u a g e s h o u l d e n s u r e t h a t no o b j e c t will r e c e i v e a m e s s a g e t h a t it c a n n o t p r o c e s s and it c a n opt imize the b i n d i n g of m e s s a g e names to code . In t h i s p a p e r , we d i s c u s s a p r o b l e m in t h e d e s i g n of s u c h a l a n g u a g e t h a t d o e s no t a p p e a r to h a v e b e e n wide ly r e c o g n i z e d . B e f o r e p r o c e e d i n g to t he , la in d i s c u s s i o n , we no t e t h a t one a p p r o a c h would b e to a c c e p t d y n a m i c t y p e c h e c k i n g , a s g r o u p s w o r k i n g wi th Smal l ta lk a n d most L I S P b a s e d O0 l a n g u a g e s h a v e done . A r g u m e n t s f o r s t a t i c t y p e c h e c k i n g b a s e d on e f f i c i e n c y a r e w e a k in v iew o f the e f f i c i e n c y of r e c e n t i m p l e m e n t a t i o n s of Sma l l t a lk -80 [ U n g a r 8 6 ] . T h e r e a r e , h o w e v e r , o t h e r a r g u m e n t s f o r s t a t i c t y p e c h e c k i n g . In p a r t i c u l a r , t y p e d p r o g r a m s a r e e a s i e r to r ead , u n d e r s t a n d , a n d d e b u g t h a n u n t y p e d p r o g r a m s . T y p e d e c l a r a t i o n s a r e a n aid to t h e p r o g r a m m e r and impose an o b l i g a t i o n on t h e compi le r to g e n e r a t e c o d e t h a t will no t fa i l a t r u n t i m e b e c a u s e of i n c o r r e c t t y p i n g . A l t h o u g h Small ta lk d o e s no t r e q u i r e t y p e d e c l a r a t i o n s , Smal l ta lk p r o g r a m s a r e ful l o f names l ike anIn~eger, aWindow, ano~herWindow, and so on, s u g g e s t i n g t h a t e v e n Small talk p r o g r a m m e r s l ike to k n o w the t y p e s o f t he i r o b j e c t s . 109 SIGPLAN Notices, Vol. 24, No. ii We h a v e w r i t t e n t h e e x a m p l e s o f t h i s p a p e r in Deep a n OO l a n g u a g e [ G r o g o n o 8 9 b ] based on a type theory [Grogono89a] that our research group is d e v e l o p i n g at Concordia University. Dee inherits ideas from Simula67 [Birtwistle73]~ Smalltalk [Goldberg83], and Eiffel [Meyer88]. Since Dee syntax is quite like Pascal syntax, we will explain only those features of %he; code which may nol be obvious to experienced programmers.
[1]
Elliott Mendelson,et al.
Introduction to mathematical logic (3. ed.)
,
1987
.
[2]
Luca Cardelli,et al.
A Semantics of Multiple Inheritance
,
1984,
Inf. Comput..
[3]
David Ungar,et al.
The design and evaluation of a high performance Smalltalk system
,
1987
.
[4]
Craig Schaffert,et al.
An introduction to Trellis/Owl
,
1986,
OOPLSA '86.
[5]
Philip Wadler,et al.
How to make ad-hoc polymorphism less ad hoc
,
1989,
POPL '89.
[6]
Adele Goldberg,et al.
SmallTalk 80: The Language
,
1989
.
[7]
Larry Carter,et al.
Distrbution and Abstract Types in Emerald
,
1987,
IEEE Transactions on Software Engineering.
[8]
興風會圖書館野田読書會.
N.D.K.
,
1946
.
[9]
簡聰富,et al.
物件導向軟體之架構(Object-Oriented Software Construction)探討
,
1989
.