4 ms·
> For example, the Julia community seems to have coined the term “type-stability” to describe a concept that static / compiled languages have historically enfor
by vanderZwan 11y ago
> For example, the Julia community seems to have coined the term “type-stability” to describe a concept that static / compiled languages have historically enforced and dynamic / scripting languages have historically disregarded.
I was not aware that this was a Julia neologism. It seems like such an appropriate term for discussing how to make code make the most out of JIT-compilation.
- jakub_h 11y agoI thought that type stability was actually a crucial notion in real-world dynamic language implementations? Witness inline caches and polymorphic inline caches, for example.
- StefanKarpinski 11y agoThe concept is certainly not new, but googling "type stability" seems to only turn up Julia-related pages or other, unrelated uses of the term, so it seems like this usage may have been coined in the Julia community. If you find prior uses with this meaning, please do let me know.
- ViralBShah 11y agoYeah seems so. Perhaps worth having a wikipedia page for it now!
- openasocket 11y agoThe closest concept I can think of is the concept of "strong typing," that a value does not change type based on its context, which is a fairly widely used term. It seems like Julia has some form of weak typing, at least between the different numeric primitives, and "type stability" refers to avoiding any usage of weak typing. I don't know a lot about Julia, though, so I could be way off here.
- StefanKarpinski 11y ago"Strong typing" and "weak typing" don't really mean anything: http://blogs.perl.org/users/ovid/2010/08/what-to-know-before-debating-type-systems.html http://blogs.perl.org/users/ovid/2010/08/what-to-know-before... You probably mean "static typing" versus "dynamic typing" which I wrote a bit about in the context of Julia here: http://stackoverflow.com/questions/28078089/is-julia-dynamically-typed http://stackoverflow.com/questions/28078089/is-julia-dynamic... Basically, I think "type stability" hasn't really been a thing in the past because in dynamic languages, people have traditionally not cared about ensuring that return types are predictable based on argument types, and in static languages, a program is incorrect if that's not the case. As people care more and more about being able to statically predict the behavior of programs in dynamic languages, the concept of type-stability in dynamic languages becomes increasingly important.
- openasocket 11y agoI disagree: strong and weak typing are fairly well defined terms. I'm going off the definition given in "Programming Language Pragmatics," which states "a language is strongly typed if it never allows an operation to be applied to an object that does not support it; a language is said to be statically typed if it enforces strong typing at compile time."
- jahewson 11y agoNo, the parent comment is correct: formally they're meaningless. Those definitions might be fine for casual discussions, but from an academic programming language standpoint they don't correlate to anything meaningful.
- hyperpape 11y agoI happen to think that there are meaningful things you can express by saying "Strong Typing" or "Weak Typing" (https://news.ycombinator.com/item?id=9256695 https://news.ycombinator.com/item?id=9256695), though "well defined" might be stretching it. However, I don't like this definition at all. Both JavaScript and Python prohibit operations on types that don't support them. They both have TypeErrors (or something similar) that are thrown at runtime for certain operations, while others produce a result. The difference is just that JavaScript allows a bunch of operations that Python prohibits, including several that serve almost no purpose. Is allowing 1 + "1" allowing an operation on a type that doesn't support it, or does your language just allow adding numbers and strings? There is no principled way to answer that question.