Reflection filter broken
Monkey Forums/Monkey Bug Reports/Reflection filter broken
| ||
Hello, form version 82 (and 83 too) the reflection filter is broken, which breaks the whole JungleGui events system, and quite a bit of my programs... :( This small sample replicates the issue: Import reflection #REFLECTION_FILTER+="${MODPATH}" Function Main() Print "Listing..." For Local func:FunctionInfo = EachIn GetFunctions Print func.Name Next Print "Done!" End Function Dummy:String() Return "Hello world!" End It should list "at last" Function Main and Dummy, but it does not list a single function. |
| ||
I had issues getting JungleGui to recognise my classes, actually. Maybe this was the reason... |
| ||
The reflection filter is not broken, you just made a mistake with your own code. Move the filter assignment to before your import of the 'reflection' module. You're setting a preprocessor variable after it has already been used in another module. This works just fine: Output: |
| ||
The reflection filter is not broken, you just made a mistake with your own code. Move the filter assignment to before your import of the 'reflection' module Well, current new implementation breaks the += operator logi. ,This operator is expected to be used when the directive has already been set anywhere else. Also, it makes it impossible to modify the reflection filter on any module when it is not used before any other module imports the reflection filter, which makes modules unable to rely on it! In short, If you use 2 modules that import the reflection module, the last one can't work. The second module can't add what it needs to the reflection filter. So, it's broken, or requires redesign, but it's currently quite useless as it is! |
| ||
Can you explain the problem a bit more clearly Ziggy? Been a while since I looked at the reflection stuff... |
| ||
OK, think I've found it - preprocessor isn't pushing/popping ${CD} or ${MODPATH}. |
| ||
Yea, i found the problem weeks before and i was thinking, its my fault... |
| ||
Can you explain the problem a bit more clearly Ziggy? OK, think I've found it - preprocessor isn't pushing/popping ${CD} or ${MODPATH}. I think you answered yourlself? The problem is that most of JungleGui modules import reflection and add themselves to the reflection filter by using the += operator, but it was failing to work. By the way, did you ever found the time to look at this? http://www.monkey-x.com/Community/posts.php?topic=8140&post=81614&view=all#81614 |
| ||
Ok, just committed a bunch of stuff including a fix for this - and hopefully for the 'have to import superclass modules' issue too. Needs more testing before I build a release, but have a go at the github version if you can. |
| ||
Thanks! I'll give it a try during this week with Jungle Gui, which uses reflection very extensively. Also, I could test the Friend and Private keywords too that seems to be added. Not sure how their syntax work... ? |
| ||
Hello, I've been testing this and been unable to make reflection work with JungleGui. the different JungleGui modules import reflection when they needed and use the REFLECTION_FILTER+= to register themselves into the filter. If I do a small smaple with 2 files or the like, the latest changes seem to fix the reflection filter issue, but when using the whole junglegui module, it does not work and none of the samples are able to register event listeners due missing reflection registration... I'm a bit lost, if anyone can lend a hand to locate the issue... that's the JungleGui repository: https://github.com/ziggybcn/junglegui |