[Pharo-dev] reflection examples
siguctua at gmail.com
Wed Aug 21 05:59:05 EDT 2013
Hmm, given such examples, it makes me doubt, how to properly answer the
'what is reflection'..
Because when you saying:
SomeClass selectors includes: #foo
is it using reflection? but looking from plain perspective it is nothing
accessing properties stored in object, using methods, provided by object..
and not much different to accessing properties of any other object , like:
so, what kind of access is clearly 'reflective', and what is not?
On 20 August 2013 23:08, Torsten Bergmann <astares at gmx.de> wrote:
> Ask someone from another language how they count their
> tests classes. In Smalltalk you can easily:
> TestCase allSubclasses size
> or write other nice statistics scripts about your programs.
> Reflection can be used to find an appropriate selector when you
> know the input and the result. I'm sure you know that features available in
> the finder tool: 3. 4. 7.
> or according examples from the finder tool like:
> MethodFinder methodFor: #( (4 3) 7 (0 5) 5 (5 5) 10).
> Maybe the PragmaCollector is also a nice example: just define a method
> and then:
> (PragmaCollector filter: [:pragma | #todo = pragma keyword]) reset
> Also have a look at "Teachable" from config browser. It's not directly
> to reflection but shows how easy it is to use #doesNotUnderstand and write
> mocks. One can do other nice tricks - like implement a getter
> automagically when it
> is not there, ...
> Beware - you already know the "true become: false" trick ;)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Pharo-dev