I wanted to clarify more on my other response.

As Amy referred this does not happen to Dictionary object alone. create an 
instance of any object , then call a non existing method and you won't get 
compile time errors.

Example
var data:Array = new Array()
data.xyz() //xyz method does not exist in Array, but still no compile time 
errors.

Without compile time errors, when things don't work in run time, it wastes lot 
of my time to find the problem.

Any help from Flex gurus are appreciated.

Thanks
Ben

--- In flexcoders@yahoogroups.com, "droponrcll" <amyblankens...@...> wrote:
>
> 
> 
> --- In flexcoders@yahoogroups.com, "benjamine_df" <benjamine_df@> wrote:
> >
> > Hello,
> > 
> >   I am new to flex and I make lot of mistakes by calling a method or
> >  field in an object which does not exist. But flex builder 3 doesn't 
> > seem to throw a compile error when I do this. In java it would be a 
> > quick compile error. Is there any flex builder setting I can set to 
> > give compile errors.
> > 
> > Example
> > var data:Dictionary = new Dictionary();
> > data.length   //no compile error for this
> > data[indexint]  //no compile error
> 
> Create your own typed objects if you want type checking:
> 
> public clas YourClass {
>    public var indexInt:int;
>    public var length:int;
> }
> 
> var yourClass:YourClass = newYourClass();
> 
> var foo:String = YourClass.foo; //compiler error
> 
> 
> I'm pretty sure Java wouldn't throw a compiler error if you add or access a 
> previously nonexistent key to a Dictionary, either, since that's pretty much 
> the point of a Dictionary in most languages, isn't it?
> 
> -Amy
>


Reply via email to