
Classifying Prototyp ebased Programming Languages C Dony J Malenfant and D Bardou 1 LIRMM Universite de Montp ellier II rue Ada Montp ellier Cedex France Email donylirmmfr 2 URVALORIA Universite de Bretagne sud CGU de Vannes rue de la Loi Vannes France Email JacquesMalenfantunivubsfr Abstract The prototyp ebased programming mo del has always b een dicult to characterize precisely Prototyp ebased languages are all based on a similar set of basic principles yet they all dier in their precise in terpretation of these principles Moreover if the prototyp ebased mo del advo cates concrete ob jects as the only mean to mo del concepts cur rent languages promote metho dologies reintro ducing abstract construc tions to manage eciently groups of similar ob jects In the past we have prop osed two classications of delegationbased languages in or der to clarify these issues In the present pap er we come back to these two classications in the light of our recent work The rst classication lo oks at the primitives of the virtual machine underlying each language it classies languages according to the semantics of these primitives The second considers the grouporiented constructions provided in each language it classies languages according to the level of abstractness of these constructions The two classications complements each others and also other existing classications They allow p eople to assess more precisely the relative merits of the dierent languages Intro duction A prototyp e is a typical memb er used to represent a family or a category of ob jects Prototyp ebased languages prop ose a vision of ob jectoriented pro gramming based on the notion of prototyp e Since the middle of the eightees numerous prototyp ebased languages have b een designed and implemented self kevo agora garnet moostrap cecil omega newtonscript Other languages such as object lisp or yafool not qualied as prototyp ebased nevertheless oer closely related mechanisms or use prototyp es at the implementation level Finally sys tems mixing prototyp es and classes have also b een prop osed A very general and informal characterization of prototyp ebased languages is rather simple they prop ose a world in which there is one kind of ob jects equip ed with attributes and metho ds three primitives to create ob jects creation ex 1 We use that term to denote a structural characteristic of an ob ject or frame nihilo cloning and extension dierential copy and one control structure mes sage sending together with a delegation mechanism Beyond this generalization all these languages present slight yet profound and interesting dierences They are dierent b ecause they have b een develop ed for dierent application domains They are dierent b ecause they have b een inspired on the one hand by the earlier frame languages used in knowledge representation and on the other hand by actors languages used in distributed AI They are also dierent b ecause they have b een develop ed with dierent goals The rst goal was to provide simpler descriptions of ob jects Peoples nat ural way to grasp new concepts is generally to b egin by creating concrete examples rather than abstract descriptions classbased languages force p eo ple to work in the opp osite direction by creating abstractions classes prior concrete ob jects instances The second goal was to oer a simpler programming mo del with fewer con cepts and primitives Applications in the elds of userinterfaces and virtual reality have tried to escap e the traditional abstract data typ e mo del to move towards a less constrained one For these applications classes have b een considered as a source of complexity b ecause they are playing to o many roles The alternative solution is often based on the concept of pro totyp es more amenable to a form of programmingbyexample and providing an alternative to class instantiation and class inheritance The last goal was to oer new capabilities to represent knowledge Class based languages constrain ob jects by disallowing for example distinctive b ehavior for individual ob jects among their instances and by forbidding in heritance b etween ob jects to share values of instance variables Thus an exact and unique characterization of prototyp ebased programming raises a numb er of issues Current prototyp ebased languages dier in the semantics of ob ject representation ob ject creation ob ject encapsulation ob ject activation and ob ject inheritance There exists various interpretations of what is a prototyp e a concrete ob ject or an average representative of a concept which can lead to dierent languages The semantics of the basic mechanisms cloning dierential copy delegation is not unique and allows for dierent interpretations Dierential copy creates interdep endent ob jects and authorizes various in terpretations concerning the precise nature of the concept of ob ject they implement Finally some of the capabilities oered by classes for example the ability to express sharing at a conceptual level have revealed to b e so imp ortant for program organization that they have b een reintro duced in dierent ways So understanding each language b oth in terms of their expressive p ower and their applicability to sp ecic kinds of problems is not always easy The Frame Frame name whale name MobyDick category mammal isa whale environment sea color white enemy man enemy CptHaccab weight color blue Fig Dierential description Fig Example of Frame Treaty of Orlando prop oses a rst comparison of classbased and prototyp e based languages we go further by addressing more extensively the issues p ending the alternative semantics asso ciated to pure prototyp ebased languages and the level of abstration propsed by the dierent mecahnisms reintro ducing class func tionalities into prototyp edbased languages In the past we have prop osed two complementary classications to this end The goal of the present pap er is to come back to these two classications in order to present and explain their main classication criteria but also to complement them in the light of our recent work The rest of the p qp er is organized as follos Section recalls the genesis of prototyp ebased programming and thus prop oses a rst classication of lan guages Section prop oses a rst classication of prototyp ebased languages according to the vision their conceptor had on them Section presents the com parison criteria related to primitive op erations and mechanisms that constitute a prototyp ebased language virtual machine Section presents the comparison criteria related to how programs written in prototyp ebased languages are orga nized Section prop oses the two classications of languages according to the previously dened criteria Genesis of the Prototyp eBased Programming Mo del To understand the genesis of ideas is a rst imp ortant step in a classication pro cess This section recalls how framebased and actor languages have inuenced prototyp ebased ones Prototyp es and knowledge representation The concepts of prototyp e and dierential description can b e found in the frame theory and in some systems inspired from this theory such as the framebased languages krl or frl Frames have b een designed as an alternative way to represent knowledge such as typicality default values or exceptions which are dicult to describ e in other formalisms Framebased languages use the prototyp es theory and they have inuenced some prototyp ebased languages Structure A frame is a set of attributes Each attribute represents one characteristic of the frame and is made of a couple attribute name set of facets The most common facet and the only one considered in our examples is the attributes value The gure shows a denition of a frame representing a whale Dierential description Dierential description makes it p ossible to cre ate a new frame by only expressing the dierences from an existing one The dierential description creates a relation b etween the new frame and the former its prototyp e or parent This relation is implemented by a link generally called isa The gure shows the denition of a frame representing MobyDick which lo oks like the ab ove whale but is white and has a sp ecic enemy Frame hierarchies and inheritance The isa relation is an order rela tion that denes frame hierarchies A frame can inherit from its parent a set of attributes Framebased systems prop ose inheritance hierarchies made of representatives of concepts which are conceptually very similar to those built later with prototyp ebased systems One can generally nd at the top of those hierarchies average representatives such as whale and at the b ottom concrete representatives such as MobyDick What is tremendously imp ortant here is that what is shared are not descriptions as with class inheritance but rather concrete representations and so bindings of slots to values Actor languages To represent entities with classless ob jects has also b een prop osed in descrip tions of act although the pap ers related to this language dont mention neither the prototyp e concept nor its use in the earlier framebased languages act provides ob jects and mechanisms conceptually close to those describ ed ab ove and part of the fundamental characteristics of to days prototyp ebased language From our p oint of view the main dierence b etween the framebased lan guage krl quoted ab ove and act is that act is a programming and not a representation language Actors thus have attributes acquointances and a set of b ehavior We will use the term metho d to denote the representation
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages28 Page
-
File Size-