SlideShare ist ein Scribd-Unternehmen logo
1 von 19
Downloaden Sie, um offline zu lesen
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
2
Outline
1. Prototype OO Languages
2. Expressing Different Languages
3. Prototalk
4. Example: Newtonscript
5. Conclusion
3
Prototype OO Languages
• Classless paradigm
• A prototype contains its state and
behavior
• Link between prototypes is usually
done using:
• Delegation
• Composition
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
5
Prototalk
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
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
8
Architecture
AbstractObjectModel
evaluate: sourceCode
compileMethodAt: name
compile: codeSource
globalVar: varName put: aValue
nodeBuilder
NodeBuilder
newVariableName: name
newMessageReceiver: rcvr
...
ProgramNode
eval: context
MethodNode
selector
block
eval: context
applyWith: args in: context
VariableNode
variableName
eval: context
MessageNode
selector
eval: context
Language1
variables
methods
methodOwner: name
clone
...
Language1NodeBuilder
newVariableName: name
newMessageReceiver:
...
Language1
VariableNode
eval: context
Language1
MessageNode
eval: context
Prototalk Base
Implementation of Language1
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:, ...
10
Example: NewtonScript
• It has a double inheritance: _proto is
searched prior to _parent
_parent
_proto
11
Double Inheritance
f := {getX: funct() x, _proto: {_proto: {x: 10}}};
f._parent := {x: 20};
f getX x: 10
x: 20
_parent
_proto
f.getX() ==> 10
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.’
13
In Prototalk
AbstractProto
NewtonScriptLike
parent
proto
methodOwner: name
methodOwnerInProto: name
t := self methodOwnerInProto: name.
^ t isNil
ifTrue: [
parent isNil
ifTrue: [nil]
ifFalse: [parent methodOwner: name]]
ifFalse: [t]]
^ (slots includesKey: name)
ifTrue: [self]
ifFalse: [
proto isNil
ifTrue: [nil]
ifFalse:
[proto methodOwnerInProto: name]]
slots
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
15
• Prototalk: an Environment for
Teaching, Understanding, Designing
and Prototyping OO languages
• bergel@iam.unibe.ch
16
17
Hierarchy of Object Model
AbstractProto
newEmpty
SlotProto
slots
clone
addSlot: name
method: code
methodNamed: name
L11
initInitials: slots
newInitials: slots
L11AndImplicitDelegation
parent
clone
methodLookup: name
parent
son
L16
ModifiableSlot
L7
L7AndImplicitDelegation
parent
initializeParent: parent
close
SelfLike
addSlot: slot
assignmentMethod: code
L7AndExplicitDelegation
18
ProgramNodeBuilder
SelfLikeAssignment
MethodBuilder
Smalltalk ProgramNodeBuilder
Prototalk ProgramNodeBuilder
ProgramNodeBuilder
newCondition(cond, then, else)
newLiteralValue(literal)
newMessageReceiver(object)
newMethodSelector(methName)
newVariable(varName)
newAssignmentVariable(name)
ImplicitDelegationPNB
newMessageReceiver: object
ImplicitDelegation
EncapsulationPNB
newMessageReceiver: object
newAssignmentVariable: name
ObjectLispLikePNB
newMessageReceiver: object
SelfLikePNB
newVariable: varName
EncapsulationPNB
newVariable: varName
newAssignmentVariable: name
ExplicitDelegationPNB
newMessageReceiver: object
ExplicitDelegationEncapsulationPNB
newVariable: varName
newAssignmentVariable: name
AbstractProto
nodeBuilder
19
Self, ObjectLisp, ...
Person
age=26
name=Luc
eat=...
Student
num=1234567
grade=2
doExam=...
Person
age=26
name=Luc
eat(...)
Student
num=1234567
grade=2
doExam(...)

Weitere ähnliche Inhalte

Andere mochten auch (7)

Welcome ESUG 2005
Welcome ESUG 2005Welcome ESUG 2005
Welcome ESUG 2005
 
MBA Smalltalk: to manage your objects
MBA Smalltalk: to manage your objectsMBA Smalltalk: to manage your objects
MBA Smalltalk: to manage your objects
 
trabalho 2
trabalho 2trabalho 2
trabalho 2
 
The Value of Smalltalk
The Value of SmalltalkThe Value of Smalltalk
The Value of Smalltalk
 
Meta-Driven Browsers
Meta-Driven BrowsersMeta-Driven Browsers
Meta-Driven Browsers
 
Ocean
OceanOcean
Ocean
 
Application-Specific Models and Pointcuts using a Logic Meta Language
Application-Specific Models and Pointcuts using a Logic Meta LanguageApplication-Specific Models and Pointcuts using a Logic Meta Language
Application-Specific Models and Pointcuts using a Logic Meta Language
 

Ähnlich wie Prototalk

Future Programming Language
Future Programming LanguageFuture Programming Language
Future Programming Language
YLTO
 
TI1220 Lecture 14: Domain-Specific Languages
TI1220 Lecture 14: Domain-Specific LanguagesTI1220 Lecture 14: Domain-Specific Languages
TI1220 Lecture 14: Domain-Specific Languages
Eelco Visser
 
Pal gov.tutorial4.session12 2.wordnets
Pal gov.tutorial4.session12 2.wordnetsPal gov.tutorial4.session12 2.wordnets
Pal gov.tutorial4.session12 2.wordnets
Mustafa Jarrar
 
Python and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthroughPython and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthrough
gabriellekuruvilla
 
20100730 phpstudy
20100730 phpstudy20100730 phpstudy
20100730 phpstudy
Yusuke Ando
 

Ähnlich wie Prototalk (20)

Design patterns illustrated 010PHP
Design patterns illustrated 010PHPDesign patterns illustrated 010PHP
Design patterns illustrated 010PHP
 
1. Mini seminar intro
1. Mini seminar intro1. Mini seminar intro
1. Mini seminar intro
 
Future Programming Language
Future Programming LanguageFuture Programming Language
Future Programming Language
 
Python for Delphi Developers - Part 1 Introduction
Python for Delphi Developers - Part 1 IntroductionPython for Delphi Developers - Part 1 Introduction
Python for Delphi Developers - Part 1 Introduction
 
These questions will be a bit advanced level 2
These questions will be a bit advanced level 2These questions will be a bit advanced level 2
These questions will be a bit advanced level 2
 
biopython, doctest and makefiles
biopython, doctest and makefilesbiopython, doctest and makefiles
biopython, doctest and makefiles
 
EKON 25 Python4Delphi_mX4
EKON 25 Python4Delphi_mX4EKON 25 Python4Delphi_mX4
EKON 25 Python4Delphi_mX4
 
Python: The Programmer's Lingua Franca
Python: The Programmer's Lingua FrancaPython: The Programmer's Lingua Franca
Python: The Programmer's Lingua Franca
 
Xbase implementing specific domain language for java
Xbase  implementing specific domain language for javaXbase  implementing specific domain language for java
Xbase implementing specific domain language for java
 
TI1220 Lecture 14: Domain-Specific Languages
TI1220 Lecture 14: Domain-Specific LanguagesTI1220 Lecture 14: Domain-Specific Languages
TI1220 Lecture 14: Domain-Specific Languages
 
Comment Asciidoctor peut vous aider pour votre doc
Comment Asciidoctor peut vous aider pour votre docComment Asciidoctor peut vous aider pour votre doc
Comment Asciidoctor peut vous aider pour votre doc
 
PHP 8: Process & Fixing Insanity
PHP 8: Process & Fixing InsanityPHP 8: Process & Fixing Insanity
PHP 8: Process & Fixing Insanity
 
Andy On Closures
Andy On ClosuresAndy On Closures
Andy On Closures
 
Ekon 25 Python4Delphi_MX475
Ekon 25 Python4Delphi_MX475Ekon 25 Python4Delphi_MX475
Ekon 25 Python4Delphi_MX475
 
Intro to Python
Intro to PythonIntro to Python
Intro to Python
 
Pal gov.tutorial4.session12 2.wordnets
Pal gov.tutorial4.session12 2.wordnetsPal gov.tutorial4.session12 2.wordnets
Pal gov.tutorial4.session12 2.wordnets
 
Python and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthroughPython and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthrough
 
DSL's with Groovy
DSL's with GroovyDSL's with Groovy
DSL's with Groovy
 
Creating a textual domain specific language
Creating a textual domain specific languageCreating a textual domain specific language
Creating a textual domain specific language
 
20100730 phpstudy
20100730 phpstudy20100730 phpstudy
20100730 phpstudy
 

Mehr von ESUG

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programming
ESUG
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and Roadmap
ESUG
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...
ESUG
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early results
ESUG
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
ESUG
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test Generation
ESUG
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic Programming
ESUG
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
ESUG
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience Report
ESUG
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIs
ESUG
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
ESUG
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and Future
ESUG
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and Transformations
ESUG
 

Mehr von ESUG (20)

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programming
 
Technical documentation support in Pharo
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in Pharo
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and Roadmap
 
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in Pharo
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early results
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test Generation
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic Programming
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience Report
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIs
 
Garbage Collector Tuning
Garbage Collector TuningGarbage Collector Tuning
Garbage Collector Tuning
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and Future
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the Debugger
 
Websockets for Fencing Score
Websockets for Fencing ScoreWebsockets for Fencing Score
Websockets for Fencing Score
 
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
 
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocAdvanced Object- Oriented Design Mooc
Advanced Object- Oriented Design Mooc
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and Transformations
 

Kürzlich hochgeladen

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Kürzlich hochgeladen (20)

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 

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