Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Pharo: A
Reflective System
Marcus Denker
http://rmod.lille.inria.fr
What is it?
Language + Environment
Simple Language (based on Smalltalk)
Object-Oriented, Dynamic, Reflective
Explore + Chan...
Pharo: Open Source
MIT license
Mac, Linux, Windows
Great community
Improving steadily
Many excellent libraries

(Android, ...
Simple Language
“Objective-C without C”
Reflection
Code (description)
Description

Running Program
Description

Running
Program
Definition:
!

A reflective system is a system which incorporates
causally connected structures representing (aspects of)
it...
Introspection
Introspection
Self-representation can be queried
Intercession
Self-representation can be changed
!

Reflectio...
Structure and Behavior
Structural Reflection
Concerned with static structure
packages, classes, methods…
Behavioral Reflecti...
Why?
Future Systems…
Complex: Runtime can not be ignored
Analyse at runtime
Live Programming
!

“Eternal” Evolution
Development...
Live Programming: Development at Runtime
Reflection is the basis
Classes, Methods, Packages are Objects
The tools manipulate these Objects
Inspector
Demo: Inspect World
Demo: Changing a class at runtime
Demo: Reflective Execution Stack
Reflective
Challenges
Three Examples

•

Partial Behavioral Reflection

•

Controlling Reflection

•

Reflection and the Virtual Machine
Advanced Reflection
•

Partial Behavioral Reflection

•

Associate MetaObject with structural object
•

e.g. methods, slots…...
Partial Behavioral Reflection

•

Change behaviour for selected AST Nodes

•

“All assignments”

•

“this message send”
But...
Partial Behavioral Reflection
meta-object
links

activation
condition
source code
(AST)
Uses…
•

Debugger
•

BreakPoints, WatchPoints

•

Profilers

•

Coverage Analysis

•

AOP
Controlling Reflection
Reflection is dangerous
Everything is possible
!
!

Can we control the effect of Reflective Change?
System - as - Objects
Put “virtualization” in the language
!

We already use “Images”
!

Make the Image a first class conce...
Pharo JIT Compiler
“traditional JIT”: per method translation to native code
!

Already fast, but slower than e.g JVM
!

Ne...
Reflective Optimization
We can stop execution
!

We can manipulate the stack
!

And then continue
Type Feedback JIT
Sista
!

Work with
E. Miranda
!
Future: Beyond Text
Methods in Pharo are still Strings
!

Why not use a reflective model for methods?
!

Text editor modifie...
Open Pharo Sprints
May 2008 Bern

July 2009 Bern

October 2009 Lille
November 2009 Buenos Ares
March 2010 Bern

May 2010 B...
The next one is tomorrow!
!

	

14h Building B in front of B31
Picture on Slide 7:
Source code ON PAPER, available under Creative
Commons
http://www.flickr.com/photos/toolmantim/61704481...
Upcoming SlideShare
Loading in …5
×

Pharo: A Reflective System

4,170 views

Published on

A short 30minute talk held at Inria Lille, 13/02/2014 as a "30 min of Science" presentation.

More about Pharo at http://pharo.org

Published in: Technology
  • Be the first to comment

Pharo: A Reflective System

  1. 1. Pharo: A Reflective System Marcus Denker http://rmod.lille.inria.fr
  2. 2. What is it? Language + Environment Simple Language (based on Smalltalk) Object-Oriented, Dynamic, Reflective Explore + Change running systems ! The Ultimate Programming Environment!
  3. 3. Pharo: Open Source MIT license Mac, Linux, Windows Great community Improving steadily Many excellent libraries (Android, iOS)
  4. 4. Simple Language
  5. 5. “Objective-C without C”
  6. 6. Reflection
  7. 7. Code (description)
  8. 8. Description Running Program
  9. 9. Description Running Program
  10. 10. Definition: ! A reflective system is a system which incorporates causally connected structures representing (aspects of) itself. ! (Patty Maes, OOPSLA 87)
  11. 11. Introspection Introspection Self-representation can be queried Intercession Self-representation can be changed ! Reflection = Introspection + Intercession
  12. 12. Structure and Behavior Structural Reflection Concerned with static structure packages, classes, methods… Behavioral Reflection Concerned with program execution method execution, assignment, execution stack…
  13. 13. Why?
  14. 14. Future Systems… Complex: Runtime can not be ignored Analyse at runtime Live Programming ! “Eternal” Evolution Development does not stop after deployment Enable evolution in deployment
  15. 15. Live Programming: Development at Runtime
  16. 16. Reflection is the basis
  17. 17. Classes, Methods, Packages are Objects
  18. 18. The tools manipulate these Objects
  19. 19. Inspector
  20. 20. Demo: Inspect World
  21. 21. Demo: Changing a class at runtime
  22. 22. Demo: Reflective Execution Stack
  23. 23. Reflective Challenges
  24. 24. Three Examples • Partial Behavioral Reflection • Controlling Reflection • Reflection and the Virtual Machine
  25. 25. Advanced Reflection • Partial Behavioral Reflection • Associate MetaObject with structural object • e.g. methods, slots… • AST nodes
  26. 26. Partial Behavioral Reflection • Change behaviour for selected AST Nodes • “All assignments” • “this message send” But without changing the program code!
  27. 27. Partial Behavioral Reflection meta-object links activation condition source code (AST)
  28. 28. Uses… • Debugger • BreakPoints, WatchPoints • Profilers • Coverage Analysis • AOP
  29. 29. Controlling Reflection Reflection is dangerous Everything is possible ! ! Can we control the effect of Reflective Change?
  30. 30. System - as - Objects Put “virtualization” in the language ! We already use “Images” ! Make the Image a first class concept in the language
  31. 31. Pharo JIT Compiler “traditional JIT”: per method translation to native code ! Already fast, but slower than e.g JVM ! Next Step: Type feedback runtime optimiser in the VM A lot of work ==> not realistic
  32. 32. Reflective Optimization We can stop execution ! We can manipulate the stack ! And then continue
  33. 33. Type Feedback JIT Sista ! Work with E. Miranda !
  34. 34. Future: Beyond Text Methods in Pharo are still Strings ! Why not use a reflective model for methods? ! Text editor modifies directly the objects, not text
  35. 35. Open Pharo Sprints May 2008 Bern July 2009 Bern October 2009 Lille November 2009 Buenos Ares March 2010 Bern May 2010 Buenos Ares June 2010 Bern June 2010 Bruxelles July 2010 London September 2010 Barcelona September 2010 Lille January 2011 Lille July 2011 Lille October 2011 Bruxelles February 2012 Bern April 2012 Lille September 2012 Ghent October 2013 Lille November 2013 Buenos Aires
  36. 36. The next one is tomorrow! ! 14h Building B in front of B31
  37. 37. Picture on Slide 7: Source code ON PAPER, available under Creative Commons http://www.flickr.com/photos/toolmantim/6170448143/

×