- Trending Categories
- Data Structure
- Operating System
- MS Excel
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is Dynamic Type Checking?
Type checking is the activity of providing that the operands of an operator are of compatible types. A compatible type is one that is legal for the operator or is enabled under language rules to be implicitly modified by compiler-generated code to a legal type. This automatic conversion is known as coercion. If all binding of variables to type is dynamic in a language, thus type checking can virtually continually be completed dynamically. The dynamic type checking is done during program execution.
The dynamic type checking is generally executed by saving a type tag in each data object that expresses the data type of the object. For example, an integer data object can include both the integer value and an integer type tag.
Each operation is then executed to, start with, a type-checking sequence in which the type tag of each argument is examined. The operation is implemented only if the argument types are right alternatively an error is indicated. The operation should also connect the appropriate type tags to its result that subsequent operations can check them i.e., dynamic checking is completed by inserting more code into the program to identify impending errors.
Advantage of Dynamic Type Checking
There are the following advantages of dynamic type checking which are as follows −
There is no flexibility in program design.
There is no requirement for declarations.
The type of data object associated with a variable name can be changed as per need during the program execution.
Dynamic type checking can find many errors that cannot be identified by static type checking.
In most languages, static type checking is not possible for some language constructs in certain cases but the same purpose can be achieved by dynamic type checking.
Disadvantage of Dynamic Type Checking
There are the following disadvantages of dynamic type checking which are as follows −
The dynamic type checking takes up more space as the dynamic type checking involves inserting extra code into the program to detect impending errors.
Programs are difficult to debug as all possible execution paths are not explored during program testing.
The dynamic type checking takes more time which reduces the speed of executing the operation.
It is less efficient than static type checking.
It is more expensive.
Errors can lurk in a program until they are reached during execution.
Large programs tend to have portions that are rarely executed, so a program can be in use for a long time before dynamic type checking detects a type error.
Properties that depend on values computed at runtime are rarely checked. For example, imperative languages rarely check that an array index is within bounds.
The fundamental hardware does not implement for dynamic type checking.
It can manage the tags and increases the complexity.
- Related Articles
- What is Static Type Checking?
- What is the difference between dynamic type variables and object type variables?
- What is dynamic binding in Java?
- What is Dynamic Polymorphism in C#?
- What is dynamic binding in C#?
- What is dynamic frequency selection (DFS)?
- What is Dynamic Memory Allocation in C?
- What is Dynamic Testing? (Types, Techniques, Example)
- Creating a variable with dynamic variable type in SAP ABAP
- What is runtime polymorphism or dynamic method overloading?
- What is meant by Java being a dynamic language?
- What is the difference between static and dynamic polymorphism?
- What is a Dynamic channel allocation in computer networks?
- What is the working of Dynamic Host Configuration Protocol?