0
© Marcus Denker
The Reflectivity
Marcus Denker
with:
Philippe Marschall
David Röthlisberger
Nik Haldiman / Stefan Reichhart...
© Marcus Denker
Structural Reflection
> Structure modeled as objects
— Classes, methods are objects
— Causally connected
> ...
© Marcus Denker
Methods and Reflection
> Method are Objects
> No high-level model for sub-method elements
— Message sends
—...
© Marcus Denker
Sub-Method Reflection
> Many tools work on sub method level
— Profiler, Refactoring Tool, Debugger, Type Che...
© Marcus Denker
Solution: Reflective Methods
> Annotated, persistent AST
> Bytecode generated on demand and cached
:Reflecti...
© Marcus Denker
Reflectivity
> Implementation of Reflective Methods for Squeak
Smalltalk
> Smalltalk Compiler generates Refle...
© Marcus Denker
DEMO I
> Show invalidation of code
> Show assert Demo
© Marcus Denker
Reflective Methods: Annotations
> Source visible annotations
— extended Smalltalk syntax
> Source invisible...
© Marcus Denker
Example: Pluggable Type-System
> Example for textual annotations
bitFromBoolean: aBoolean <:type: Boolean ...
© Marcus Denker
Reflex: Partial Behavioral Reflection
> Hooksets: collection of operation occurrences
> Links
— Bind hookset...
© Marcus Denker
Links as Annotations
Meta
Link
> Links can be annotations on the AST
© Marcus Denker
Demo II: Geppetto
> Show Bounce Demo
Upcoming SlideShare
Loading in...5
×

Demo: Reflectivity

867

Published on

Demo of Reflectivity, held at ESUG 2007, Lugano, Switzerland,

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
867
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Demo: Reflectivity"

  1. 1. © Marcus Denker The Reflectivity Marcus Denker with: Philippe Marschall David Röthlisberger Nik Haldiman / Stefan Reichhart Adrian Lienhard / Lukas Renggli Eric Tanter Stephane Ducasse Oscar Nierstrasz
  2. 2. © Marcus Denker Structural Reflection > Structure modeled as objects — Classes, methods are objects — Causally connected > Uses: — Development environments — Language extensions and experiments
  3. 3. © Marcus Denker Methods and Reflection > Method are Objects > No high-level model for sub-method elements — Message sends — Assignments — Variable access > Structural reflection stops at the granularity of methods
  4. 4. © Marcus Denker Sub-Method Reflection > Many tools work on sub method level — Profiler, Refactoring Tool, Debugger, Type Checker > Communication between tools needed — example: Code coverage > All tools use different representations — Tools are harder to build — Communication not possible
  5. 5. © Marcus Denker Solution: Reflective Methods > Annotated, persistent AST > Bytecode generated on demand and cached :ReflectiveMethod annotation #(12 13 45 38 98 128 84 72 42 77 22 28 59 32 7 49 51 87 64) :CompiledMethod compiledMethod reflectiveMethodannotation Tools VM
  6. 6. © Marcus Denker Reflectivity > Implementation of Reflective Methods for Squeak Smalltalk > Smalltalk Compiler generates Reflective Methods — Translated to Bytecode on demand > Open Compiler: Plugins — Generator plugin: called before code generation – Transform a copy of the AST — Analysis plugin: called after name analysis
  7. 7. © Marcus Denker DEMO I > Show invalidation of code > Show assert Demo
  8. 8. © Marcus Denker Reflective Methods: Annotations > Source visible annotations — extended Smalltalk syntax > Source invisible annotations — Reflective API — Can reference any object > Every node can be annotated > Semantics: Compiler Plugins (9 raisedTo: 10000) <:evaluateAtCompiletime:>
  9. 9. © Marcus Denker Example: Pluggable Type-System > Example for textual annotations bitFromBoolean: aBoolean <:type: Boolean :> ^ (aBoolean ifTrue: [1] ifFalse: [0]) <:type: Integer :> > Optional, pluggable type-system > Types stored as annotations in the Reflective Methods
  10. 10. © Marcus Denker Reflex: Partial Behavioral Reflection > Hooksets: collection of operation occurrences > Links — Bind hooksets to metaobjects — Define Protocol between base and meta > Goals — Highly selective reification — Flexiblel metalevel engineering – Protocol specification – Cross-cutting hooksets activation condition hookset metaobject links Tanter, OOPSLA03
  11. 11. © Marcus Denker Links as Annotations Meta Link > Links can be annotations on the AST
  12. 12. © Marcus Denker Demo II: Geppetto > Show Bounce Demo
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×