i heard that these(say for example Groovy) languages have the capability of changing the variable name or call methods dynamically in runtime! What you meant by dynamic languages? And what is the real need for changing any values during runtime? Is that doen't lead to confusion, because at runtime if you change any value(or your programming constriants change anything), then whats the need for compilation(because it decides and confirms these values will be used, then there is no meaning of changing it in dynamically)? And i know there should be something useful, so only people have introduced these concepts!I guess i'm clear about my question! And i need some brief explanation :)
I have heard dynamic changing during Runtime? Whats that?
dynamic typing
Dynamic languages give you flexibility and expressiveness in your code. But can also make things difficult to follow sometimes, and definately opens up the potentials of abuse as @TheLQ points out but it has its benefits as well. As the question was around groovy, I want to point out that there is a guide specifically on Dynamic Groovy.First of all, Using metaclasses I can augment my classes at runtime to change behaviours of individual instances or of all instances that will ever be declared, even static methods. These metaclasses can be used for convience (think extending final classes with methods that you've always wanted... Groovy in fact has a number of convient augmentations all of their classes), and is also handy for mocking parts of classes for various tests or hacks you need.Additionally you can implement methodMissing and propertyMissing to use the signature of the method invoked to dynamically drive content. For example, GORM has Dynamic Finders takes advantage of this to make querying more concise. Instead of having to construct a HSQL query, or other hoops I can do object.findAllNameAndVersion(name,123) As a side note Rails also has this ability.Hope this helps!