Can someone tell me what Strong typing and weak typing means and which one is better?
相关问题
- How do you work with a variable that can be of mul
- Inferred Type and Dynamic typing
- Common Lisp type declarations not working as expec
- How to use static type checking using Dict with di
- .NET Table Adapters: Get vs. Fill?
相关文章
- When is sqlite's manifest typing useful?
- Why do COM libraries used from C# 4.0 require such
- Enforcing types on untyped data in TypeScript
- How do I initialize a vector with an array of valu
- Why aren't typedefs strongly typed?
- What does “no global type inference” mean regardin
- Linq to Entities Filtering an Entity Dynamic/Stron
- Is PowerShell a strongly-typed language?
Strong/weak typing in a language is related to how easily you can do type conversions:
For example in Python:
Where as in C language:
Thus Python is more strongly typed than C (from this perspective).
May be this can help you to understand Strong and Weak Typing.......
Strong typing: It checks the type of variables as soon as possible, usually at compile time. It prevents mixing operations between mismatched types.
A strong-typed programming language is one in which:
Weak Typing: While weak typing is delaying checking the types of the system as late as possible, usually to run-time. In this you can mix types without an explicit conversion.
A "weak-typed" programming language is simply one which is not strong-typed.
which is preferred depends on what you want. for scripts and good stuff you will usually want weak typing, because you want to write as much less code as possible. in big programs, strong typing can reduce errors at compile time.