PDA

View Full Version : Not having to declare Types


OmenKing
04-11-2008, 03:41 PM
Is there anyway so I don't have to declare the type of every single variable in flex when I compile?

In Flash CS3 they don't bother me, Flex won't let me proceed, anyway to turn off these errors?

I'm not using Flex Builder, I'm compiling.

OmenKing
04-11-2008, 04:08 PM
ahhh on compile just have to pass --strict=false --warnings=false

kahuja
04-11-2008, 04:59 PM
not declaring type for every is a bad practice, should not do it.

OmenKing
04-11-2008, 06:02 PM
The readability of the code is so poor with declarations everywhere.
I'm not programming in C here, its a scripting language.

I don't think its poor practice.

sleekdigital
04-11-2008, 06:27 PM
Strict is turned on by default for good reason. Call it a "scripting" language if like, but actionscript is compiled and strong typing is a big advantage. Why would you want to track down type mismatches manually when the compiler can do it for you? Once you get used to it the code becomes more readable than without declaring types if you ask me. Not to mention that you miss out on code completion in your IDE if you do not use strong typing. I can't imagine readability being a reason to not use strinct typing.

OmenKing
04-11-2008, 07:06 PM
I'm using TextMate, not an IDE.
If your code is written clean enough and you adopt a good set conventions it isn't necessary. I wish it were in ruby instead. Its a good thing they got HotRuby.

dr_zeus
04-11-2008, 09:33 PM
I'm not programming in C here, its a scripting language.

I'd say more out of legacy than anything else. With classes and inheritance, JIT compiling in the virtual machine, RegEx, E4X, and all the other features that make AS3 better than older versions, we've got a language as powerful or close enough to most of the big programming languages out there.

If your code is written clean enough and you adopt a good set conventions it isn't necessary.

I consider it necessary for all my code. Why? If you declare types on all your variables, the compiler will be able to make some heavy optimizations that make your code run over 10 times faster.

sleekdigital
04-11-2008, 09:48 PM
the compiler will be able to make some heavy optimizations that make your code run over 10 times faster.


Thanks for bringing that one up dr zeus, how could I have left that one out of my argument :)

Also, If you want code completion for free, get FlashDevelop.

kahuja
04-13-2008, 08:26 AM
One more addition to the whole thing that comes under the bucket of having a scalable applications. If you are going to use a backend J2EE server like tomcat, JBoss with BlazeDS, then having strongly typed objects will give you serialization capabilities out of the box.

Having strongly typed objects is a great plus in many ways.