Answer the question
In order to leave comments, you need to log in
Why so much enthusiasm around typing? I think it's much easier without it, no?
Hello.
I am a simple web developer and frankly do not understand why there is so much noise around "strong typing" and all that stuff.
Personally, the need to prescribe the data type everywhere would have put me on the contrary.
In my opinion, the ability to not do this in PHP and JS is just the same advantage.
So right?
Answer the question
In order to leave comments, you need to log in
I will supplement all other answers that you should not confuse strong typing with static typing .
Typehints in the same php make it much easier to understand and develop code, leaving it still a weakly typed language.
It's not normal to write code and not know what types you're working with.
This leads to errors, complicates code understanding, and greatly complicates static analysis.
Therefore, in php there is vimeo psalm, phpdocs with types and type hints from version 7, and in js typescript (any other kotlin native by the way)
Knowing the type of the variable, the development environment can suggest:
In some languages, such as Kotlin, the type system allows you to keep track of null values and handle them in your code.
Moreover, most statically typed languages have the ability to infer a type from an expression. Those. you can write a type only where it is really necessary. The difference from JS is that types are still tracked at compile time and you can't assign a value of another type to a variable.
The entry of the form is
equivalent to the entry
This will result in an error:
val a = 2 + 3
a = "Hello"
If there are types and compilation, then more than half of the bugs are caught by the compiler.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question