• Like


Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Uploaded on

Prototalk: an Environment for Teaching, Understanding, Designing and Prototyping OO Languages. Alexandre Bergel, Christophe Dony, Stéphane Ducasse (ESUG 2004, Koethen) …

Prototalk: an Environment for Teaching, Understanding, Designing and Prototyping OO Languages. Alexandre Bergel, Christophe Dony, Stéphane Ducasse (ESUG 2004, Koethen)

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads


Total Views
On Slideshare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide


  • 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. Outline 1. Prototype OO Languages 2. Expressing Different Languages 3. Prototalk 4. Example: Newtonscript 5. Conclusion 2
  • 3. Prototype OO Languages • Classless paradigm • A prototype contains its state and behavior • Link between prototypes is usually done using: • Delegation • Composition 3
  • 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. Prototalk 5
  • 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. 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. Architecture Prototalk Base MethodNode selector AbstractObjectModel block eval: context evaluate: sourceCode applyWith: args in: context compileMethodAt: name NodeBuilder compile: codeSource ProgramNode globalVar: varName put: aValue newVariableName: name nodeBuilder eval: context newMessageReceiver: rcvr ... MessageNode VariableNode selector variableName eval: context eval: context Language1 Language1NodeBuilder Language1 variables MessageNode methods newVariableName: name methodOwner: name newMessageReceiver: eval: context clone ... ... Language1 VariableNode eval: context Implementation of Language1 8
  • 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. Example: NewtonScript _parent _proto • It has a double inheritance: _proto is searched prior to _parent 10
  • 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 11 _proto
  • 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. 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] methodOwner: name ifFalse: [ proto isNil methodOwnerInProto: name ifTrue: [nil] ifFalse: [proto methodOwnerInProto: name]] 13
  • 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. • Prototalk: an Environment for Teaching, Understanding, Designing and Prototyping OO languages • bergel@iam.unibe.ch 15
  • 16. 16
  • 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 L11AndImplicitDelegation parent parent initializeParent: parent clone close methodLookup: name parent son SelfLike addSlot: slot L16 assignmentMethod: code 17
  • 18. ProgramNodeBuilder Smalltalk ProgramNodeBuilder ProgramNodeBuilder newCondition(cond, then, else) AbstractProto newLiteralValue(literal) newMessageReceiver(object) nodeBuilder newMethodSelector(methName) newVariable(varName) newAssignmentVariable(name) EncapsulationPNB ExplicitDelegationPNB ImplicitDelegationPNB newMessageReceiver: object newMessageReceiver: object SelfLikeAssignment newVariable: varName MethodBuilder newAssignmentVariable: name ImplicitDelegation SelfLikePNB ExplicitDelegationEncapsulationPNB EncapsulationPNB newVariable: varName newVariable: varName newMessageReceiver: object newAssignmentVariable: name newAssignmentVariable: name ObjectLispLikePNB Prototalk ProgramNodeBuilder newMessageReceiver: object 18
  • 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