#REFLECTION_FILTER improvement or alternative?

Monkey Forums/Monkey Programming/#REFLECTION_FILTER improvement or alternative?

ziggy(Posted 2012) [#1]
EDITED TO ClARIFY THE ISSUE:

Ok, I've just seen that REFLECTION_FILTER is FILE based, so #REFLECTION_FILTER="main*" reflects everything declared in main.monkey and in any file that is imported by main that is also in the same folder level as main or in a subfolder of the original main.monkey location.

It would be very nice to have this explained a bit more in the docs. Also, I still think it would be great to be able to add files to the REFLECTION_FILTER from within an imported module.

Then, the problem I'm facing: I have a module that is a GUI library that is using reflection and it can't set its own filter in case it has been set by the main file, and if it is set in the main file, its own filter fails so the module does not work.

If we could have a sort of:
#REFLECTION_FILER+=

this would solve any of the potential issues explained here. (I feel a bit like I'm talking to myself in this thread, but just in case this is useful to others...)


This is the old original post:
Am I right to assume it can only appear once in a whole project? I'm designing a framework and I would my module to be able to add some items to whatever reflectionfilter is already set, without resetting it. Something like REFLECTION_FILTER_ADD Is there any way to do this?

Ok, it seems this is a bug.
Example:
module:
Import reflection
#REFLECTION_FILTER="module*"

Now program using the module:
Import reflection
#REFLECTION_FILTER="program*"

Result= a mess. It is not working, or it is working partially, or nothing gets filtered and I get a HUGE application... Not sure it's a bug, but definitivelly this needs clarification and *maybe* a twist.

If I leave the #REFLECTION_FILTER only in one of the two places (the module of the program file) EVERYTHING is reflected.



ziggy(Posted 2012) [#2]
EDITED: See first post http://www.monkeycoder.co.nz/Community/posts.php?topic=3002


ziggy(Posted 2012) [#3]
EDITED: See http://www.monkeycoder.co.nz/Community/posts.php?topic=3002


ziggy(Posted 2012) [#4]
EDITED: See first post.


wiebow(Posted 2012) [#5]
Yes, this is a little something I had to figure out by experimenting with my unit test module... You can only have one filter per project: wiki entry: http://code.google.com/p/mutated-monkey/wiki/unittest

Being able to add more files to the filter would be really nice to have, indeed and would clear up this messy bit. Maybe Mark had to arrange this a certain way to guarantee certain prerequisites for all target languages.


ziggy(Posted 2012) [#6]
I know you can have just one filter per project. the problem I see is that this filter can only be set at one place. I see this as a problem. I think the reflection filter should be acting like a "concatenation", so any new reflection filter is added to the reflection filter, and affect following imports.


wiebow(Posted 2012) [#7]
I worded myself wrongly. I am aware that you know that there can be only one filter and it can only be in one place, and that concatenation of all the filters in the project files at the start of compilation would be awesome.


jpoag(Posted 2012) [#8]
+1 agreed. This would be an awesome addition.