Predicting Variable Types in Dynamically Typed Programming Languages
1–10 of 37 posts
Re: Predicting Variable Types in Dynamically Typed Programming Languages
#2Re: Predicting Variable Types in Dynamically Typed Programming Languages
#3Modern compilers for statically typed languages are really good at inferring types of various identifiers based on multiple hints in a deterministic way (see Kotlin, Swift etc). Mentioned statically typed languages C,C++ and Java are pretty old and therefore carry some baggage of verbosity that is no longer needed.
> ...since the variable types are not declared in the source code, the source code becomes difficult to understand and extend
> For programmers working on the large code base written in dynamic languages, it is hard to understand the control flow of the program if the types are not available at the compile time.
Dynamic languages as a result of their "dynamicness" tend to allow much better expression of control flow when compared to static languages. Only recently available statically typed languages have targeted expressiveness as a first class goal in designing the language. In fact, statically typed languages are notorious for obtuse control flows as a result of their type enforcement (see C, C++, Golang)
Re: Predicting Variable Types in Dynamically Typed Programming Languages
#4It's not perfect, but it's the only way I've found that makes sense in combination with Forth-like stack semantics where function parameters are never specified explicitly. And that runs fast enough to make sense in an interpreted language. I also like that it's implemented as a transformation on VM code, which makes it flexible and easy to debug.
Re: Predicting Variable Types in Dynamically Typed Programming Languages
#5How does this relate and compare to actual type inference? For example, Common Lisp implementation SBCL is able to infer types pretty nicely now and it doesn't need neural networks for "predicting" the types with some kind of chance.
Re: Predicting Variable Types in Dynamically Typed Programming Languages
#6> ...allows programmers to write code quickly by not requiring to declare the types of each variable which are determined at run-time based on the values assigned to that variable, thereby increasing programmer productivity Modern compilers for statically typed languages are really good at inferring types of various identifiers based on multiple hints in a deterministic way (see Kotlin, Swift etc). Mentioned statical…
I think it’s importatnt to mention that in Swift this lookup has exponential behavior, and can time out if the expression is too complex.
Re: Predicting Variable Types in Dynamically Typed Programming Languages
#7Re: Predicting Variable Types in Dynamically Typed Programming Languages
#8How does this relate and compare to actual type inference? For example, Common Lisp implementation SBCL is able to infer types pretty nicely now and it doesn't need neural networks for "predicting" the types with some kind of chance.
I’m not sure how much of it is still relevant to SBCL since the fork was quite a while back, but the CMUCL user manual is a great read that describes how type inference and many other things work. https://www.cs.utexas.edu/users/jared/Milawa/Support/cmucl64...
"FIXME: The material in the CMUCL manual about getting good performance from the compiler should be reviewed, reformatted in Texinfo, lightly edited for SBCL, and substituted into this manual. In the meantime, the original CMUCL manual is still 95+% correct for the SBCL version of the Python compiler."
Re: Predicting Variable Types in Dynamically Typed Programming Languages
#9How does this relate and compare to actual type inference? For example, Common Lisp implementation SBCL is able to infer types pretty nicely now and it doesn't need neural networks for "predicting" the types with some kind of chance.
Re: Predicting Variable Types in Dynamically Typed Programming Languages
#10> ...allows programmers to write code quickly by not requiring to declare the types of each variable which are determined at run-time based on the values assigned to that variable, thereby increasing programmer productivity Modern compilers for statically typed languages are really good at inferring types of various identifiers based on multiple hints in a deterministic way (see Kotlin, Swift etc). Mentioned statical…
hahaha. Just getting people to adopt `auto` in C++ is an uphill battle. People want to write types.