Some favorite site feeds aggregated locally: iPhone Development RSS   Adobe Labs RSS   Macrumors RSS

Wednesday, June 25, 2008

Reserved IDE import & package import?

Wednesday, June 25, 2008   

One thing I'd like to see in regards to import statements on symbols coming from the IDE's library... demand an implicit import statement. I've seen a few document classes out there that call up class objects from the SWF's library. This is cool, but when you look at the document class, you just see something like

var foo:Sprite = new ClassName;

That's cool if you're the only one who will ever look at the document class, but it makes others wonder where the hell that thing is coming from. Perhaps something declared like:

import $ide.ClassName;

Then you could use that asset ... or something to let the world know where that thing is coming from. I don't know the specifics of the ramifications of this, but sometimes I run into this myself. I set up an asset in the SWF and it's subclassing something (say Sprite) and it has it's own class name. It's then simply used in the document class. It confuses some other developers... they don't know where it came from until I tell them its in the Library set to export to that class name. 

I suppose I could just link it to my own class for it and be done with it, but that's a bit of pain in the ass. Well, it can be if it's just a simple UI element.

So maybe something reserved so it's clear its not part of someone else's package. I don't know. It would help a bit... and on the topic of imports...

You can instantiate class objects in a class as long as the classes are all in the same package without using import statements... the compiler looks and finds them. 

...
var foo:SomeClass = new SomeClass;

Without an import statement, you have to check the package directory and look for that class. 

An import statement is best form in my opinion. Not importing saves you a few seconds of time but adds confusion to anyone else combing your code.
 
 Return to the main page
Comments:

There are currently 0 Comments:

 Leave a comment