I was thinking about adding support for Railo in version 2.0.
Originally my main reason for not supporting Railo was its lack of
Hibernate ORM. Since that's no longer the case, the main barrier to
Railo support is ColdMVC's use of an undocumented feature in Adobe
ColdFusion that allows you to create global variables using the
underlying page context. This is done to add new "scopes" to your
application, namely "params", "flash", "coldmvc" and "$".
Since 2.0 already includes a handful of breaking changes, albeit
nothing too terrible, I was thinking about refactoring how these
global scopes are created and used in ColdMVC. Long story short, I
want them to still be available, but not globally. Global variables
are typically considered bad and can make testing somewhat difficult.
* Note: since the coldmvc scope and $ scope are essentially the same
thing, I'll only refer to it as the coldmvc scope for the rest of this
message.
Here are some thoughts on how the scopes could work:
The scopes would only be available to controllers. The params scope
and flash scope would be passed to each action as named arguments.
Since they're named arguments and will always be passed to the
actions, you shouldn't need to defined them in your method definition
or prefix them with "arguments." when using them inside your actions.
For the most part, your controller code would remain unchanged. The
coldmvc scope would be injected into each controller automatically and
set into the variables scope after the controller is created, as well
as passed to an init() method if it existed on the controller and you
wanted to use helpers during object instantiation.
Aside from controllers, other components in your application would not
have access to any of these scopes by default. Typically the params
scope and flash scope should only be accessed in the controller
anyways. If you need to access a param inside a method in a service,
the values should be passed in as arguments. As for the coldmvc scope,
I would add logic to have the beanFactory to look for a coldmvc
property on singleton components to autowire the helpers into the
component.
As for views, I don't think they should have access to any of the
scopes. The params scope is automatically copied into the view's
variables scope and the flash scope shouldn't be accessed outside of a
controller. As for helpers, most of the time your view should be using
viewHelpers for common helper functionality so I don't see a huge need
to have the coldmvc scope automatically added to views, although I
could easily add it if we feel it's necessary.
I haven't made any of these changes yet, so if anyone has any ideas,
suggestions, objections or concerns, please speak up.
I'd like to get version 2.0 released sometime this weekend, so now's
your chance to help mold the framework.
Thanks,
Tony