[ALOY-101] Allow Alloy.Models.MODEL_NAME notation
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | Medium |
Status | Closed |
Resolution | Won't Fix |
Resolution Date | 2012-09-11T14:46:15.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Runtime, XML |
Labels | n/a |
Reporter | Tony Lukasavage |
Assignee | Tony Lukasavage |
Created | 2012-07-17T06:03:41.000+0000 |
Updated | 2014-01-28T23:18:01.000+0000 |
Description
Models, Collections, Components, and Widgets are currently accessible via the Alloy.get() methods. It would be nice to also have them available with the old
Alloy.Models.MODEL_NAME
format. To do so, the optimizer needs to be updated to convert those namespaces into the performance-friendly get() calls.
Originally mentioned here: https://github.com/appcelerator/alloy/commit/8b0a21e448b0ec7c9f03dfa02eec0328e86d3a49#commitcomment-1589909
This will likely be on hold for now given the reasons cited in the github issue: I think I might hold off on this one, mainly because it might be confusing to developers that the OO style is not valid at runtime. For example, this wouldn't generate correctly as it's a runtime constraint:
It's perfectly valid JS, but our optimizer won't catch it and it will return
undefined
forMODEL_NAME
. I think this needs to be a runtime assignment and I'm not sure offhand how to do that for a property without loading all the models, collections, components, and widgets at application load time. The function syntax seems to be the only way to defer the loading of these modules.