Is type declaration a big part of the positives of static typed languages? [closed]
Statically typed programming languages do type checking at compiling. Is type declaration an important reason that is making them significantly faster?
static-typing
closed as primarily opinion-based by Samuel Liew♦ Nov 14 '18 at 10:55
Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
Statically typed programming languages do type checking at compiling. Is type declaration an important reason that is making them significantly faster?
static-typing
closed as primarily opinion-based by Samuel Liew♦ Nov 14 '18 at 10:55
Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.
You can write very complex (say) Haskell programs without ever adding a type declaration/signature, the compiler will infer the types and produce efficient code. So: are type declarations necessary to have efficient code? No. Apart from that there is a huge field about compiling/tpye inference etc. Your question is way too broad and open ended.
– Giacomo Alzetta
Nov 14 '18 at 9:09
static type checking reduces the amount of time spent compiling the code as it doesn't need to use as much type interference. If the amount of time and resources spent compiling is limited, the compiler can spend more time on optimising other aspects of the application. This makes it more practical to compile the code more efficiently to native code.
– Peter Lawrey
Nov 14 '18 at 9:17
@GiacomoAlzetta haskell has other restrictions on things like side effects to improve efficiency ;)
– Peter Lawrey
Nov 14 '18 at 9:20
1
@PeterLawrey You understood the question and answered what's needed. The question was talking about static typed languages not that declarations are important for all kinds of languages, thanks.The guy above you not so much.
– user131811
Nov 14 '18 at 9:29
add a comment |
Statically typed programming languages do type checking at compiling. Is type declaration an important reason that is making them significantly faster?
static-typing
Statically typed programming languages do type checking at compiling. Is type declaration an important reason that is making them significantly faster?
static-typing
static-typing
edited Nov 14 '18 at 9:36
Gihan Saranga Siriwardhana
614424
614424
asked Nov 14 '18 at 9:01
user131811user131811
154
154
closed as primarily opinion-based by Samuel Liew♦ Nov 14 '18 at 10:55
Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.
closed as primarily opinion-based by Samuel Liew♦ Nov 14 '18 at 10:55
Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.
You can write very complex (say) Haskell programs without ever adding a type declaration/signature, the compiler will infer the types and produce efficient code. So: are type declarations necessary to have efficient code? No. Apart from that there is a huge field about compiling/tpye inference etc. Your question is way too broad and open ended.
– Giacomo Alzetta
Nov 14 '18 at 9:09
static type checking reduces the amount of time spent compiling the code as it doesn't need to use as much type interference. If the amount of time and resources spent compiling is limited, the compiler can spend more time on optimising other aspects of the application. This makes it more practical to compile the code more efficiently to native code.
– Peter Lawrey
Nov 14 '18 at 9:17
@GiacomoAlzetta haskell has other restrictions on things like side effects to improve efficiency ;)
– Peter Lawrey
Nov 14 '18 at 9:20
1
@PeterLawrey You understood the question and answered what's needed. The question was talking about static typed languages not that declarations are important for all kinds of languages, thanks.The guy above you not so much.
– user131811
Nov 14 '18 at 9:29
add a comment |
You can write very complex (say) Haskell programs without ever adding a type declaration/signature, the compiler will infer the types and produce efficient code. So: are type declarations necessary to have efficient code? No. Apart from that there is a huge field about compiling/tpye inference etc. Your question is way too broad and open ended.
– Giacomo Alzetta
Nov 14 '18 at 9:09
static type checking reduces the amount of time spent compiling the code as it doesn't need to use as much type interference. If the amount of time and resources spent compiling is limited, the compiler can spend more time on optimising other aspects of the application. This makes it more practical to compile the code more efficiently to native code.
– Peter Lawrey
Nov 14 '18 at 9:17
@GiacomoAlzetta haskell has other restrictions on things like side effects to improve efficiency ;)
– Peter Lawrey
Nov 14 '18 at 9:20
1
@PeterLawrey You understood the question and answered what's needed. The question was talking about static typed languages not that declarations are important for all kinds of languages, thanks.The guy above you not so much.
– user131811
Nov 14 '18 at 9:29
You can write very complex (say) Haskell programs without ever adding a type declaration/signature, the compiler will infer the types and produce efficient code. So: are type declarations necessary to have efficient code? No. Apart from that there is a huge field about compiling/tpye inference etc. Your question is way too broad and open ended.
– Giacomo Alzetta
Nov 14 '18 at 9:09
You can write very complex (say) Haskell programs without ever adding a type declaration/signature, the compiler will infer the types and produce efficient code. So: are type declarations necessary to have efficient code? No. Apart from that there is a huge field about compiling/tpye inference etc. Your question is way too broad and open ended.
– Giacomo Alzetta
Nov 14 '18 at 9:09
static type checking reduces the amount of time spent compiling the code as it doesn't need to use as much type interference. If the amount of time and resources spent compiling is limited, the compiler can spend more time on optimising other aspects of the application. This makes it more practical to compile the code more efficiently to native code.
– Peter Lawrey
Nov 14 '18 at 9:17
static type checking reduces the amount of time spent compiling the code as it doesn't need to use as much type interference. If the amount of time and resources spent compiling is limited, the compiler can spend more time on optimising other aspects of the application. This makes it more practical to compile the code more efficiently to native code.
– Peter Lawrey
Nov 14 '18 at 9:17
@GiacomoAlzetta haskell has other restrictions on things like side effects to improve efficiency ;)
– Peter Lawrey
Nov 14 '18 at 9:20
@GiacomoAlzetta haskell has other restrictions on things like side effects to improve efficiency ;)
– Peter Lawrey
Nov 14 '18 at 9:20
1
1
@PeterLawrey You understood the question and answered what's needed. The question was talking about static typed languages not that declarations are important for all kinds of languages, thanks.The guy above you not so much.
– user131811
Nov 14 '18 at 9:29
@PeterLawrey You understood the question and answered what's needed. The question was talking about static typed languages not that declarations are important for all kinds of languages, thanks.The guy above you not so much.
– user131811
Nov 14 '18 at 9:29
add a comment |
2 Answers
2
active
oldest
votes
A statically typed language is one in which the type of every variable is known at compile-time. In some languages like C, C++, Java the programmer must manually specify the type and in other languages like Haskell and Scala has some form of type inference
, the capability of the type system to deduce the type of a variable.
Does it make them faster?
1. Figuring out the type at compile-time does reduce a lot of overhead for the run-time.
2. Because the types are figured out earlier on, even functions/ methods in the language are well defined into static addresses. Where as in a dynamically typed language names are based on strings. And for each method access, lookups have to be done. Which are many, causing the language to be slower.
add a comment |
yes static declarations of variables improves execution speed
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
A statically typed language is one in which the type of every variable is known at compile-time. In some languages like C, C++, Java the programmer must manually specify the type and in other languages like Haskell and Scala has some form of type inference
, the capability of the type system to deduce the type of a variable.
Does it make them faster?
1. Figuring out the type at compile-time does reduce a lot of overhead for the run-time.
2. Because the types are figured out earlier on, even functions/ methods in the language are well defined into static addresses. Where as in a dynamically typed language names are based on strings. And for each method access, lookups have to be done. Which are many, causing the language to be slower.
add a comment |
A statically typed language is one in which the type of every variable is known at compile-time. In some languages like C, C++, Java the programmer must manually specify the type and in other languages like Haskell and Scala has some form of type inference
, the capability of the type system to deduce the type of a variable.
Does it make them faster?
1. Figuring out the type at compile-time does reduce a lot of overhead for the run-time.
2. Because the types are figured out earlier on, even functions/ methods in the language are well defined into static addresses. Where as in a dynamically typed language names are based on strings. And for each method access, lookups have to be done. Which are many, causing the language to be slower.
add a comment |
A statically typed language is one in which the type of every variable is known at compile-time. In some languages like C, C++, Java the programmer must manually specify the type and in other languages like Haskell and Scala has some form of type inference
, the capability of the type system to deduce the type of a variable.
Does it make them faster?
1. Figuring out the type at compile-time does reduce a lot of overhead for the run-time.
2. Because the types are figured out earlier on, even functions/ methods in the language are well defined into static addresses. Where as in a dynamically typed language names are based on strings. And for each method access, lookups have to be done. Which are many, causing the language to be slower.
A statically typed language is one in which the type of every variable is known at compile-time. In some languages like C, C++, Java the programmer must manually specify the type and in other languages like Haskell and Scala has some form of type inference
, the capability of the type system to deduce the type of a variable.
Does it make them faster?
1. Figuring out the type at compile-time does reduce a lot of overhead for the run-time.
2. Because the types are figured out earlier on, even functions/ methods in the language are well defined into static addresses. Where as in a dynamically typed language names are based on strings. And for each method access, lookups have to be done. Which are many, causing the language to be slower.
edited Nov 14 '18 at 9:35
user131811
154
154
answered Nov 14 '18 at 9:32
clmnoclmno
580215
580215
add a comment |
add a comment |
yes static declarations of variables improves execution speed
add a comment |
yes static declarations of variables improves execution speed
add a comment |
yes static declarations of variables improves execution speed
yes static declarations of variables improves execution speed
answered Nov 14 '18 at 9:04
Muhammad ShahjadMuhammad Shahjad
12
12
add a comment |
add a comment |
You can write very complex (say) Haskell programs without ever adding a type declaration/signature, the compiler will infer the types and produce efficient code. So: are type declarations necessary to have efficient code? No. Apart from that there is a huge field about compiling/tpye inference etc. Your question is way too broad and open ended.
– Giacomo Alzetta
Nov 14 '18 at 9:09
static type checking reduces the amount of time spent compiling the code as it doesn't need to use as much type interference. If the amount of time and resources spent compiling is limited, the compiler can spend more time on optimising other aspects of the application. This makes it more practical to compile the code more efficiently to native code.
– Peter Lawrey
Nov 14 '18 at 9:17
@GiacomoAlzetta haskell has other restrictions on things like side effects to improve efficiency ;)
– Peter Lawrey
Nov 14 '18 at 9:20
1
@PeterLawrey You understood the question and answered what's needed. The question was talking about static typed languages not that declarations are important for all kinds of languages, thanks.The guy above you not so much.
– user131811
Nov 14 '18 at 9:29