rubymirrors 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. data/Gemfile +7 -0
  2. data/README.md +30 -0
  3. data/Rakefile +13 -0
  4. data/lib/abstract_reflection.rb +112 -0
  5. data/lib/abstract_reflection/class_mirror.rb +150 -0
  6. data/lib/abstract_reflection/compiler_mirror.rb +31 -0
  7. data/lib/abstract_reflection/field_mirror.rb +35 -0
  8. data/lib/abstract_reflection/gc_mirror.rb +19 -0
  9. data/lib/abstract_reflection/method_mirror.rb +253 -0
  10. data/lib/abstract_reflection/mirror.rb +108 -0
  11. data/lib/abstract_reflection/object_mirror.rb +48 -0
  12. data/lib/abstract_reflection/stack_frame_mirror.rb +61 -0
  13. data/lib/abstract_reflection/thread_mirror.rb +64 -0
  14. data/lib/maglev/reflection.rb +49 -0
  15. data/lib/maglev/reflection/class_mirror.rb +157 -0
  16. data/lib/maglev/reflection/core_ext/class_organizer.rb +20 -0
  17. data/lib/maglev/reflection/core_ext/maglev.rb +5 -0
  18. data/lib/maglev/reflection/core_ext/method.rb +154 -0
  19. data/lib/maglev/reflection/core_ext/module.rb +41 -0
  20. data/lib/maglev/reflection/core_ext/object.rb +4 -0
  21. data/lib/maglev/reflection/core_ext/thread.rb +226 -0
  22. data/lib/maglev/reflection/field_mirror.rb +39 -0
  23. data/lib/maglev/reflection/field_mirror/fixed_instance_variable_mirror.rb +25 -0
  24. data/lib/maglev/reflection/method_mirror.rb +149 -0
  25. data/lib/maglev/reflection/mirror.rb +6 -0
  26. data/lib/maglev/reflection/object_mirror.rb +18 -0
  27. data/lib/maglev/reflection/stack_frame_mirror.rb +104 -0
  28. data/lib/maglev/reflection/thread_mirror.rb +116 -0
  29. data/lib/rubinius/reflection.rb +6 -0
  30. data/lib/ruby/reflection.rb +74 -0
  31. data/lib/ruby/reflection/class_mirror.rb +89 -0
  32. data/lib/ruby/reflection/field_mirror.rb +32 -0
  33. data/lib/ruby/reflection/field_mirror/class_variable_mirror.rb +25 -0
  34. data/lib/ruby/reflection/field_mirror/constant_mirror.rb +36 -0
  35. data/lib/ruby/reflection/field_mirror/instance_variable_mirror.rb +25 -0
  36. data/lib/ruby/reflection/method_mirror.rb +122 -0
  37. data/lib/ruby/reflection/mirror.rb +12 -0
  38. data/lib/ruby/reflection/object_mirror.rb +25 -0
  39. data/lib/ruby/reflection/stack_frame_mirror.rb +49 -0
  40. data/lib/ruby/reflection/support/shift_reset.rb +29 -0
  41. data/lib/ruby/reflection/thread_mirror.rb +47 -0
  42. data/rubymirrors.gemspec +12 -0
  43. data/spec/class_spec.rb +92 -0
  44. data/spec/field_spec.rb +119 -0
  45. data/spec/fixtures/class_spec.rb +29 -0
  46. data/spec/fixtures/field_spec.rb +9 -0
  47. data/spec/fixtures/method_spec.rb +14 -0
  48. data/spec/fixtures/object_spec.rb +5 -0
  49. data/spec/fixtures/reflect_spec.rb +14 -0
  50. data/spec/fixtures/stack_frame_spec.rb +5 -0
  51. data/spec/fixtures/thread_spec.rb +5 -0
  52. data/spec/frame_spec.rb +80 -0
  53. data/spec/method_spec.rb +166 -0
  54. data/spec/object_spec.rb +18 -0
  55. data/spec/reflection_spec.rb +74 -0
  56. data/spec/spec_helper.rb +16 -0
  57. data/spec/spec_helper/mspec_patch.rb +29 -0
  58. data/spec/spec_helper/multiple_reflections.rb +14 -0
  59. data/spec/thread_spec.rb +142 -0
  60. metadata +173 -0
metadata ADDED
@@ -0,0 +1,173 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rubymirrors
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Tim Felgentreff
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-11-10 00:00:00 Z
19
+ dependencies: []
20
+
21
+ description: |
22
+ ## A mirror API for Ruby
23
+
24
+ In various [research][p1] [projects][p2] the advantages of having a [mirror
25
+ API][p3] to separate reflection from a language implementation have
26
+ been discussed, and "industry grade" implementations exist for
27
+ [Java][p4] and [C#][p5]. This project aims at providing a number of
28
+ specs and classes that document a mirror API for Ruby. The mirror
29
+ implementation that is part of this project will use only those
30
+ language facilities that are available across Ruby implementations.
31
+ The specs, however, will also test behavior that cannot be provided in
32
+ such a manner. The idea here is that in time, all implementations
33
+ provide their own implementation of the mirror API, and all
34
+ implementations collaborate on this one spec.
35
+
36
+ Why do this, you ask? Because Ruby needs tools, and those tools need
37
+ to be written in Ruby. If they are not, then people will be excluded from
38
+ tinkering with their tools, thus impeding innovation. You only have to
39
+ look at Emacs or Smalltalk to see what's possible when programmers can
40
+ extend their tools, all tools, in a language they feel comfortable
41
+ in. If we have a standard mirror API, all tools that are written **for**
42
+ Ruby, **in** Ruby, can be shared across implementations, while at the same time
43
+ allowing language implementers to use the facilities of their platform
44
+ to provide optimal reflective capabilities without tying them to
45
+ internals.
46
+
47
+ [p1]: http://www.cs.virginia.edu/~lorenz/papers/icse03/icse2003.pdf "Pluggable Reflection: Decoupling Meta-Interface and Implementation"
48
+ [p2]: http://bracha.org/newspeak-spec.pdf "Newspeak Programming Language Draft Specification, Version 0.06, pages 40 onward"
49
+ [p3]: http://www.hpi.uni-potsdam.de/hirschfeld/events/past/media/100105_Bracha_2010_LinguisticReflectionViaMirrors_HPI.mp4 "Linguistic Reflection Via Mirrors"
50
+ [p4]: http://bracha.org/mirrors.pdf "Mirrors: Design Principles for Meta-level Facilities of Object-Oriented Programming Languages"
51
+ [p5]: http://oreilly.com/catalog/progcsharp/chapter/ch18.html "See esp. 18-3, highlighting how C# reflection works on assembly rather than VM objects"
52
+
53
+ email:
54
+ - timfelgentreff@gmail.com
55
+ executables: []
56
+
57
+ extensions: []
58
+
59
+ extra_rdoc_files: []
60
+
61
+ files:
62
+ - Gemfile
63
+ - README.md
64
+ - Rakefile
65
+ - lib/abstract_reflection.rb
66
+ - lib/abstract_reflection/class_mirror.rb
67
+ - lib/abstract_reflection/compiler_mirror.rb
68
+ - lib/abstract_reflection/field_mirror.rb
69
+ - lib/abstract_reflection/gc_mirror.rb
70
+ - lib/abstract_reflection/method_mirror.rb
71
+ - lib/abstract_reflection/mirror.rb
72
+ - lib/abstract_reflection/object_mirror.rb
73
+ - lib/abstract_reflection/stack_frame_mirror.rb
74
+ - lib/abstract_reflection/thread_mirror.rb
75
+ - lib/maglev/reflection.rb
76
+ - lib/maglev/reflection/class_mirror.rb
77
+ - lib/maglev/reflection/core_ext/class_organizer.rb
78
+ - lib/maglev/reflection/core_ext/maglev.rb
79
+ - lib/maglev/reflection/core_ext/method.rb
80
+ - lib/maglev/reflection/core_ext/module.rb
81
+ - lib/maglev/reflection/core_ext/object.rb
82
+ - lib/maglev/reflection/core_ext/thread.rb
83
+ - lib/maglev/reflection/field_mirror.rb
84
+ - lib/maglev/reflection/field_mirror/fixed_instance_variable_mirror.rb
85
+ - lib/maglev/reflection/method_mirror.rb
86
+ - lib/maglev/reflection/mirror.rb
87
+ - lib/maglev/reflection/object_mirror.rb
88
+ - lib/maglev/reflection/stack_frame_mirror.rb
89
+ - lib/maglev/reflection/thread_mirror.rb
90
+ - lib/rubinius/reflection.rb
91
+ - lib/ruby/reflection.rb
92
+ - lib/ruby/reflection/class_mirror.rb
93
+ - lib/ruby/reflection/field_mirror.rb
94
+ - lib/ruby/reflection/field_mirror/class_variable_mirror.rb
95
+ - lib/ruby/reflection/field_mirror/constant_mirror.rb
96
+ - lib/ruby/reflection/field_mirror/instance_variable_mirror.rb
97
+ - lib/ruby/reflection/method_mirror.rb
98
+ - lib/ruby/reflection/mirror.rb
99
+ - lib/ruby/reflection/object_mirror.rb
100
+ - lib/ruby/reflection/stack_frame_mirror.rb
101
+ - lib/ruby/reflection/support/shift_reset.rb
102
+ - lib/ruby/reflection/thread_mirror.rb
103
+ - rubymirrors.gemspec
104
+ - spec/class_spec.rb
105
+ - spec/field_spec.rb
106
+ - spec/fixtures/class_spec.rb
107
+ - spec/fixtures/field_spec.rb
108
+ - spec/fixtures/method_spec.rb
109
+ - spec/fixtures/object_spec.rb
110
+ - spec/fixtures/reflect_spec.rb
111
+ - spec/fixtures/stack_frame_spec.rb
112
+ - spec/fixtures/thread_spec.rb
113
+ - spec/frame_spec.rb
114
+ - spec/method_spec.rb
115
+ - spec/object_spec.rb
116
+ - spec/reflection_spec.rb
117
+ - spec/spec_helper.rb
118
+ - spec/spec_helper/mspec_patch.rb
119
+ - spec/spec_helper/multiple_reflections.rb
120
+ - spec/thread_spec.rb
121
+ homepage:
122
+ licenses: []
123
+
124
+ metadata: {}
125
+
126
+ post_install_message:
127
+ rdoc_options: []
128
+
129
+ require_paths:
130
+ - lib
131
+ required_ruby_version: !ruby/object:Gem::Requirement
132
+ none: false
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ hash: 3
137
+ segments:
138
+ - 0
139
+ version: "0"
140
+ required_rubygems_version: !ruby/object:Gem::Requirement
141
+ none: false
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ hash: 3
146
+ segments:
147
+ - 0
148
+ version: "0"
149
+ requirements: []
150
+
151
+ rubyforge_project:
152
+ rubygems_version: 1.8.10
153
+ signing_key:
154
+ specification_version: 4
155
+ summary: Mirror API for Ruby
156
+ test_files:
157
+ - spec/class_spec.rb
158
+ - spec/field_spec.rb
159
+ - spec/fixtures/class_spec.rb
160
+ - spec/fixtures/field_spec.rb
161
+ - spec/fixtures/method_spec.rb
162
+ - spec/fixtures/object_spec.rb
163
+ - spec/fixtures/reflect_spec.rb
164
+ - spec/fixtures/stack_frame_spec.rb
165
+ - spec/fixtures/thread_spec.rb
166
+ - spec/frame_spec.rb
167
+ - spec/method_spec.rb
168
+ - spec/object_spec.rb
169
+ - spec/reflection_spec.rb
170
+ - spec/spec_helper.rb
171
+ - spec/spec_helper/mspec_patch.rb
172
+ - spec/spec_helper/multiple_reflections.rb
173
+ - spec/thread_spec.rb