Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.
Prototalk: an Environment for
Teaching, Understanding, Designing
  and Prototyping OO Languages
Alexandre Bergel, Christop...
Outline

1. Prototype OO Languages
2. Expressing Different Languages
3. Prototalk
4. Example: Newtonscript
5. Conclusion

...
Prototype OO Languages

• Classless paradigm
• A prototype contains its state and
  behavior
• Link between prototypes is ...
Different Languages


• Self: Unification of variables and
  methods and multiple parents
• ObjectLisp: variables distinct...
Prototalk




    5
Goal and Design Decisions

• Uniformity: same syntax for all the
  languages
• Minimality: minimal kernel to express
  the...
Prototalk

• Language represented by a subclass of
  AbstractProto
• Execution of program by sending
  evaluate: to it
• T...
Architecture
                                                                    MethodNode
Prototalk Base
               ...
Language1

• Language1 is a subclass of
  AbstractProto
• Ability to execute programs
• Prototypes are represented by its
...
Example: NewtonScript


   _parent


        _proto




• It has a double inheritance: _proto is
  searched prior to _pare...
Double Inheritance

f := {getX: funct() x, _proto: {_proto: {x: 10}}};
f._parent := {x: 20};



                x: 20


  ...
In Prototalk

f := {getX: funct() x, _proto: {_proto: {x: 10}}};
f._parent := {x: 20};
f.getX() ==> 10



The same program...
In Prototalk
                           t := self methodOwnerInProto: name.
                           ^ t isNil
      Abs...
Conclusion


• Platform to design and experiment
  prototypes-based OO language
• Pure interpretation of programs
• Pedago...
• Prototalk: an Environment for
  Teaching, Understanding, Designing
  and Prototyping OO languages


• bergel@iam.unibe.c...
16
Hierarchy of Object Model
                                     AbstractProto

                                    newEmpty...
ProgramNodeBuilder
                                          Smalltalk ProgramNodeBuilder


                              ...
Self, ObjectLisp, ...

                      Person
  Person
                      age=26
  age=26
                     na...
Prochain SlideShare
Chargement dans…5
×

0

Partager

Télécharger pour lire hors ligne

2004 Esug Prototalk

Télécharger pour lire hors ligne

With prototype-based languages, concretization and abstraction are unified into a single concept a prototype. Prototype-based languages are based on a simple set of principles: object-centered representation, dynamic reshape of objects, cloning and possibly message delegation. However, they all differ in the interpretation and combination of these principles. Therefore there is a need to compare and understand. In this paper we present Prototalk, a research and teaching vehicle to understand, implement and compare prototype-based languages. Prototalk is a framework that offers a predefined set of language data structures and mechanisms that can be composed and extended to generate various prototype-based language interpreters. It presents a classification of languages based on different mechanisms in an operational manner.

Livres associés

Gratuit avec un essai de 30 jours de Scribd

Tout voir
  • Soyez le premier à aimer ceci

2004 Esug Prototalk

  1. 1. Prototalk: an Environment for Teaching, Understanding, Designing and Prototyping OO Languages Alexandre Bergel, Christophe Dony, Stéphane Ducasse University of Bern (Switzerland) LIRMM, Montpellier (France) bergel@iam.unibe.ch 1
  2. 2. Outline 1. Prototype OO Languages 2. Expressing Different Languages 3. Prototalk 4. Example: Newtonscript 5. Conclusion 2
  3. 3. Prototype OO Languages • Classless paradigm • A prototype contains its state and behavior • Link between prototypes is usually done using: • Delegation • Composition 3
  4. 4. Different Languages • Self: Unification of variables and methods and multiple parents • ObjectLisp: variables distinct from methods • NewtonScript: two kinds of delegation over two links 4
  5. 5. Prototalk 5
  6. 6. Goal and Design Decisions • Uniformity: same syntax for all the languages • Minimality: minimal kernel to express the most general semantics • Extensibility: new languages has to be implemented efficiently and easily • Usability: integrated in the environment 6
  7. 7. Prototalk • Language represented by a subclass of AbstractProto • Execution of program by sending evaluate: to it • The AST is built using a ProgramNodeBuilder • It is composed of subclass of the Smalltalk AST nodes 7
  8. 8. Architecture MethodNode Prototalk Base selector block AbstractObjectModel eval: context applyWith: args in: context evaluate: sourceCode compileMethodAt: name NodeBuilder compile: codeSource ProgramNode globalVar: varName put: aValue newVariableName: name eval: context nodeBuilder newMessageReceiver: rcvr ... MessageNode VariableNode selector variableName eval: context eval: context Language1 Language1 Language1NodeBuilder variables MessageNode methods newVariableName: name methodOwner: name eval: context newMessageReceiver: clone ... ... Language1 VariableNode eval: context Implementation of Language1 8
  9. 9. Language1 • Language1 is a subclass of AbstractProto • Ability to execute programs • Prototypes are represented by its instances • Provides primitives like clone, addVar: addMethod:, hasVar:, ... 9
  10. 10. Example: NewtonScript _parent _proto • It has a double inheritance: _proto is searched prior to _parent 10
  11. 11. Double Inheritance f := {getX: funct() x, _proto: {_proto: {x: 10}}}; f._parent := {x: 20}; x: 20 f getX x: 10 _parent f.getX() ==> 10 _proto 11
  12. 12. In Prototalk f := {getX: funct() x, _proto: {_proto: {x: 10}}}; f._parent := {x: 20}; f.getX() ==> 10 The same program in Prototalk: NewtonScriptLike evaluate: ‘ f := PRoot clone. f proto: (PRoot clone; proto: (PRoot clone; addSlot: ‘‘x = 10’’)). f addSlot: ‘‘getX x’’. f parent: (PRoot clone; addSlot: ‘x = 20’). f getX.’ 12
  13. 13. In Prototalk t := self methodOwnerInProto: name. ^ t isNil AbstractProto ifTrue: [ parent isNil ifTrue: [nil] ifFalse: [parent methodOwner: name]] ifFalse: [t]] NewtonScriptLike parent proto ^ (slots includesKey: name) slots ifTrue: [self] ifFalse: [ methodOwner: name proto isNil methodOwnerInProto: name ifTrue: [nil] ifFalse: [proto methodOwnerInProto: name]] 13
  14. 14. Conclusion • Platform to design and experiment prototypes-based OO language • Pure interpretation of programs • Pedagogical tool: used at University Paris VI, Montpellier and Berne 14
  15. 15. • Prototalk: an Environment for Teaching, Understanding, Designing and Prototyping OO languages • bergel@iam.unibe.ch 15
  16. 16. 16
  17. 17. Hierarchy of Object Model AbstractProto newEmpty SlotProto slots clone addSlot: name ModifiableSlot method: code methodNamed: name L11 L7 initInitials: slots newInitials: slots L7AndImplicitDelegation L7AndExplicitDelegation parent L11AndImplicitDelegation initializeParent: parent parent close clone methodLookup: name parent son SelfLike addSlot: slot L16 assignmentMethod: code 17
  18. 18. ProgramNodeBuilder Smalltalk ProgramNodeBuilder ProgramNodeBuilder newCondition(cond, then, else) AbstractProto newLiteralValue(literal) newMessageReceiver(object) nodeBuilder newMethodSelector(methName) newVariable(varName) newAssignmentVariable(name) ExplicitDelegationPNB ImplicitDelegationPNB EncapsulationPNB SelfLikeAssignment newMessageReceiver: object newMessageReceiver: object newVariable: varName MethodBuilder newAssignmentVariable: name ImplicitDelegation SelfLikePNB EncapsulationPNB ExplicitDelegationEncapsulationPNB newVariable: varName newMessageReceiver: object newVariable: varName newAssignmentVariable: name newAssignmentVariable: name ObjectLispLikePNB newMessageReceiver: object Prototalk ProgramNodeBuilder 18
  19. 19. Self, ObjectLisp, ... Person Person age=26 age=26 name=Luc name=Luc eat(...) eat=... Student Student num=1234567 num=1234567 grade=2 grade=2 doExam(...) doExam=... 19

With prototype-based languages, concretization and abstraction are unified into a single concept a prototype. Prototype-based languages are based on a simple set of principles: object-centered representation, dynamic reshape of objects, cloning and possibly message delegation. However, they all differ in the interpretation and combination of these principles. Therefore there is a need to compare and understand. In this paper we present Prototalk, a research and teaching vehicle to understand, implement and compare prototype-based languages. Prototalk is a framework that offers a predefined set of language data structures and mechanisms that can be composed and extended to generate various prototype-based language interpreters. It presents a classification of languages based on different mechanisms in an operational manner.

Vues

Nombre de vues

2 435

Sur Slideshare

0

À partir des intégrations

0

Nombre d'intégrations

112

Actions

Téléchargements

11

Partages

0

Commentaires

0

Mentions J'aime

0

×