Is type declaration a big part of the positives of static typed languages? [closed]










-2















Statically typed programming languages do type checking at compiling. Is type declaration an important reason that is making them significantly faster?










share|improve this 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















-2















Statically typed programming languages do type checking at compiling. Is type declaration an important reason that is making them significantly faster?










share|improve this 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













-2












-2








-2








Statically typed programming languages do type checking at compiling. Is type declaration an important reason that is making them significantly faster?










share|improve this question
















Statically typed programming languages do type checking at compiling. Is type declaration an important reason that is making them significantly faster?







static-typing






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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

















  • 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












2 Answers
2






active

oldest

votes


















0














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.






share|improve this answer
































    -1














    yes static declarations of variables improves execution speed






    share|improve this answer





























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      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.






      share|improve this answer





























        0














        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.






        share|improve this answer



























          0












          0








          0







          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.






          share|improve this answer















          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.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 14 '18 at 9:35









          user131811

          154




          154










          answered Nov 14 '18 at 9:32









          clmnoclmno

          580215




          580215























              -1














              yes static declarations of variables improves execution speed






              share|improve this answer



























                -1














                yes static declarations of variables improves execution speed






                share|improve this answer

























                  -1












                  -1








                  -1







                  yes static declarations of variables improves execution speed






                  share|improve this answer













                  yes static declarations of variables improves execution speed







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 14 '18 at 9:04









                  Muhammad ShahjadMuhammad Shahjad

                  12




                  12













                      Popular posts from this blog

                      Top Tejano songwriter Luis Silva dead of heart attack at 64

                      ReactJS Fetched API data displays live - need Data displayed static

                      Evgeni Malkin