Comments on “Including imports” http://play.blog2t.net/as3-include-import-directives-for-a-project/feed/Including+imports 2010-02-21T21:46:57+00:00 Chyrp Including imports tag:play.blog2t.net,2010-02-21:/id/52//comment_30539 2010-02-21T21:51:31+00:00 2010-02-21T21:46:57+00:00 Og2t http://play.blog2t.net <p>Thanks Jackson, it's nice to hear some good feedback!</p> <p>You're (mostly) right, but I only propose this solution when you're coding a single project (small website, banner etc.) that has custom classes that are unlikely to be reused. All those classes will have common imports, so you can chuck them into one file. I use Flash IDE to compile (mainly because it's so easy to create assets) and I found it easy (lazy) to have a single file with all imports. I'd never use it for framework classes or anything that could have it's own life (i.e. GUI components), and I stick to just one includes file.</p> <ol> <li> Could be so, unless you consider the above (project specific) approach. </li> <li> Sure, but it's up to you what you put into it ;-) </li> <li> I'd only use one file with imports, otherwise it's a mess. </li> <li> I think the unused classes won't get imported when not instantiated, it should be true for wildcard importing as well, that's why some people do use it. But if that's true, you may end up having a list of imports of all possible classes – then it's up to the compiler what to actually import – I know, very bad idea. </li> <li> Possibly will, especially i.e. FDT will try to add all necessary imports for you anyway. </li> </ol> <p>Just wanted to share this idea anyway.</p> Including imports tag:play.blog2t.net,2010-02-21:/id/52//comment_30533 2010-02-21T20:52:57+00:00 2010-02-21T20:52:57+00:00 Jackson Dunstan http://www.jacksondunstan.com <p>Here are some thoughts I had while reading this:</p> <ol> <li>Using an include directive seems to hide the imported classes/functions even more than wildcard importing.</li> <li>It's not immediately obvious what's in the AS file. It may even have code other than imports.</li> <li>The includes.as probably doesn't have a good set of includes for every file. So you will probably start to need multiple includes.as copies: includes_tween.as, includes_3d.as, etc.</li> <li>When includes.as doesn't have what you need, you'll need to import some more. That's not so bad, but then there's probably more in there that you're not needing. This leads to over-including and the similar problems with importing by wildcard.</li> <li>I haven't checked, but this may break IDEs (FlashDevelop, Flash Builder, FDT, etc.) and their recognition of imported types.</li> </ol>