Sunday, August 2, 2009

Some programming languages are type less. What are the obvious advantage and disadvantages of having no types?

Some programming languages are type less. What are the obvious advantage and disadvantages of having no types in a language?

Some programming languages are type less. What are the obvious advantage and disadvantages of having no types?
Having no types allows for more flexibility. This is both an advantage and disadvantage. The absence of types can create ambiguity as to the contents of a variable.
Reply:Advantages:


The only advantage is that is allows coders to write sloppy programs quickly.





Disadvantages:


1 You are not in control of the data and variables, the compiler or interpreter is.


2 If you mis-assign variables, there is no way for the compiler to catch any of your mistakes. It just "does what you said", even if it is wrong.


3 Supporting programs in a type-less language is much more difficult that in a strongly types one. It is often very difficult to determine what the original programmer wanted to do.
Reply:advantages:


you don't have to worry about types!! well it means, you don't care what you can and can not store in any particular variable. for example:





a_variable = could_be_integer_string_or_object_you_do...





2) you can re assign other stuffs to the same variable. for example


a_variable = 30


a_variable = "this is now string"





disadvantages


Well a lot! most of the is not apparent to programmer but the parser! it is slow for parser because it has to keep track what you are doing with the variable.





second and important one is that its not good programming habit and not accepted by powerful languages (c/c++/java). It allows programmer to make mistake easily.


No comments:

Post a Comment