Ultra simple reflection addition request

Monkey Forums/Monkey Programming/Ultra simple reflection addition request

ziggy(Posted 2013) [#1]
Could we have a directive to add current module to the reflecion filter?
Something like:
#REFLECT_ME
I think it would be a lot sexier than #REFLECTION_FILTER+="mymodule"

Just a small suggestion, nothing important, If this could be done per-class, that would be ultra awesome.


AndroidAndy(Posted 2013) [#2]
#REFLECT_THIS_MODULE
#REFLECT_THIS_CLASS

?


AdamRedwoods(Posted 2013) [#3]
#REFLECT_SELF
#CONTEMPLATE_EXISTANCE


AndroidAndy(Posted 2013) [#4]
hehe... good one! :)


Tibit(Posted 2013) [#5]
I Tried #REFLECTION_FILTER+="mymodule"

It does not work for me.

I have my main file. It imports a file. That file in turn imports another file. Into this file I added #REFLECTION_FILTER+="thisFile"

I'm using this to add reflection to tests, since I'd prefer the test itself says it wants to be reflected than my main file having to set complex filters for all tests!

How did you get this working?

And if it was working I don't really see the need for a #REFLECT_ME shortcut, is not that being a bit too lazy? Consider all the energy your brain have to use to memorize one additional command - I mean is it really worth it? :)


ziggy(Posted 2013) [#6]
I Tried #REFLECTION_FILTER+="mymodule"
It will only work if your main file is called mymodule.

Tibit: The main reason to request this little thingy: From my honest point of view, having this simple shortcut, we could have code that is less dependant on filenames, specially if it can be enabled in a by class basis. It's a bit weird that if you rename a file, the code inside it can stop working properly , and it can do it and silently.


Tibit(Posted 2013) [#7]
I still haven't gotten this shortcut to work in an imported file as I described above.

I think your arguments are good. Renaming a file causes events to not fire, or in my case - tests to silently not run.

So after reconsideration I do think this feature request is a quite good one and useful for many applications that actually use reflection!


ziggy(Posted 2013) [#8]
changing the folder where a file is in also breaks it.