SLIDE 1
Advanced Reflec+on & Metaprogrammming Jb Evain - - PowerPoint PPT Presentation
Advanced Reflec+on & Metaprogrammming Jb Evain - - PowerPoint PPT Presentation
Advanced Reflec+on & Metaprogrammming Jb Evain <jbevain@novell.com> Mono Team, Novell, Inc. Metaprogrammming Metaprogramming is the wri+ng of
SLIDE 2
SLIDE 3
“Metaprogramming ¡is ¡the ¡wri+ng ¡of ¡ computer ¡programs ¡that ¡write ¡or ¡ manipulate ¡other ¡programs ¡(or ¡ themselves) ¡as ¡their ¡data, ¡or ¡that ¡do ¡ part ¡of ¡the ¡work ¡at ¡compile ¡+me ¡ that ¡would ¡otherwise ¡be ¡done ¡at ¡ run+me.” ¡
hLp://en.wikipedia.com/wiki/ Metaprogramming ¡
SLIDE 4
Languages ¡/ ¡Compile ¡+me ¡ metaprogramming ¡
what ¡this ¡talk ¡is ¡not ¡about ¡
SLIDE 5
programs ¡as ¡data ¡
SLIDE 6
SLIDE 7
metadata ¡
SLIDE 8
headers ¡
SLIDE 9
tables ¡
SLIDE 10
CIL ¡
SLIDE 11
SLIDE 12
SLIDE 13
System.Reflec+on ¡
buil+n ¡
SLIDE 14
System.Reflec+on ¡
- Object.GetType ¡() ¡
- Type.GetTypeFromHandle ¡(…) ¡
- MethodBody.GetILAsByteArray ¡() ¡
SLIDE 15
Mono.Reflec+on ¡
lightweight ¡reflec+on ¡helper ¡
SLIDE 16
Mono.Reflec+on ¡
- Run+me ¡IL ¡disassembler ¡
- IL ¡paLern ¡matching ¡
- Property ¡backing ¡field ¡
SLIDE 17
Mono.Cecil ¡
Swiss ¡Army ¡Knife ¡for ¡assemblies ¡
SLIDE 18
Cross ¡Pla\orm ¡
- Mono ¡
- .net ¡>= ¡2.0 ¡
- CompactFramework ¡>= ¡2 ¡
- Silverlight ¡>= ¡2 ¡
- WP7 ¡
SLIDE 19
Why ¡
- Complete ¡metadata ¡access ¡
- No ¡AppDomain ¡bloa+ng ¡
- Collec+ble ¡data ¡
- No ¡+e ¡to ¡a ¡specific ¡mscorlib.dll ¡
- Ability ¡to ¡modify ¡exis+ng ¡assemblies ¡
SLIDE 20
Why ¡not ¡
- System.Reflec+on.Emit’s ¡
– AssemblyBuilderAccess.Run ¡ – AssemblyBuilderAccess.RunAndCollect ¡
SLIDE 21
The ¡strong ¡name ¡problem ¡
SLIDE 22
Similar ¡projects ¡
- Microsoe’s ¡CCI ¡
- IKVM.Reflec+on[.Emit] ¡
SLIDE 23
usage ¡
SLIDE 24
achievement ¡
SLIDE 25
a ¡glimpse ¡at ¡the ¡future ¡
SLIDE 26
Milo ¡
A ¡level ¡higher ¡
SLIDE 27
links ¡
- hLp://twiLer.com/jbevain ¡
- hLp://evain.net/blog ¡
- hLp://github.com/jbevain/cecil ¡
- hLp://groups.google.com/group/mono-‑cecil ¡
- hLp://github.com/jbevain/mono.reflec+on ¡
SLIDE 28