Cyrus Crypt wrote: |
Agree with you here. I saw the part on "Implicitly typed
variables", and it seems like we are falling back to VB6.0 and ASP
days. Although there is no performance penalty here, as the IL is the
same; what about code readibiliy and maintenance? Is taking type
instantisation decision away from developer a good thing?
I remember my first project that I took over. I couldn't
understand much of the previous developer's design intention, as there was no
data type. Debugging was hell.
|
|
i think you're mistaken about implicity typing versus dynamic typing. What becomes available in C# 3.0 is not dynamic typing. So what is dynamic typing? Simply put, the type information is evaluated as runtime instead of compile time. So why is that a problem? Well, the compiler will not be able to catch wrongly written statements like
var abc = "hello"; abc /= 2This is why your code maintenance task became hell. However, in C# 3.0, implicit typing is a different thing. It means the type of variable is inferred from the context,
at compile time. I also
infer that this is done using unification.
Looking at this, can anyone tell me if the type of abc can be anything other than System.String ? (or string for C# purists for that matter)
var abc = "hello"Therefore, the type of abc is now implicitly and
statically determined as System.String. The litmus test of static/dynamic typing in Orcas can be done by pressing that magical "." and see if you have Intellisense springing into action.