l-p
Ex Member
Re: ruby-processing environment
Reply #7 - Apr 2nd , 2009, 10:12am
pretty clever hack!! I didn't knew about this "included" method, and truly I'll need to read more about it before I really understand what it's doing... so, here are the cues I can give you as a tester: First, It worked!!, but not all methods seems to be present? (this may be intentionnal I don't know) like, I had a rectMode in my small test and I needed to call it from $app for it to work, but other methods like stroke, fill, rect all worked fine. Second, constants like CENTER, kinda cutted the impression my nested class had access to the nesting class scope, because I still needed to access them with the fully qualified name Processing::App::CENTER. Last, I really like the way this makes nested class behave like it would in the Java Processing API. Transparent and natural to the user, really a great gain!!! My only remaining question was about building classes as generic external widgets libraries... I then realized I could simply "include Processing::Proxy" in my external class and voilà! That simple trick would make it Processing aware, allowing sketch independent classes to be built and used as libraries. Remarkable step I think, Big cheer for Jashkenas! p.s. my test was on a really simple example, involving only one nested class, then moved it to be an external required class... so it cannot be considered really extensive testing, I would doubt more complex scenarios would break the hack, but I will try to break it anyway when I get more time to do so later today.