[osflash] MTASC and class variable assignments with commas

Merrill, Jason jason.merrill at bankofamerica.com
Wed Oct 18 11:53:22 EDT 2006


Is this a good place for MTASC questions?  If not, where?

If so, I have a question about some parse errors I am getting.
Previously when I wrote class constructors, I might have written it like
this:

class MyClass{
	
	private var a_int:Number;
	private var b_int:Number;
	private var c_str:String;
	private var d_bol:Boolean;
	
	public function MyClass(a:Number, b:Number, c:String,
d:Boolean){
		a_int = a, b_int = b, c_str = c, d_bol = d;
		doStuff();
	}

} 

I like doing variable assignments that way in constructors because it is
succinct.  But apparently using commas between variable assignments like
that causes an MTASC parse error, and I have had to format the class I
wrote previously like this instead:

class MyClass{
	
	private var a_int:Number;
	private var b_int:Number;
	private var c_str:String;
	private var d_bol:Boolean;
	
	public function MyClass(a:Number, b:Number, c:String,
d:Boolean){
		a_int = a;
		b_int = b;
		c_str = c;
		d_bol = d;
		doStuff();
	}

}

Is doing it my original way considered bad practice? If so, why?  If
not, is there a way to stop MTASC from throwing parsing errors?  I know
MTASC does better error checking than the Flash 8 compiler, but this one
surprised me a little.

Thanks,	   

Jason Merrill
Bank of America 
Learning & Organization Effectiveness - Technology Solutions 
 
 
 
 



More information about the osflash mailing list