Digest on TYPE in Programming Languages- Part I

With intrinsic focus on Typescript
CbaChellam – January 24, 2016

Atlanta,Georgia.
 220px-TypeScript_Logo

 

Introduction

 
Today’s blog post takes an aim and breaks down meticulously the TYPE in programming languages. As part of my curious research activities, i delved into a new open source language called as TYPESCRIPT. The more i dwell, i am starting to realize that there is more depth and dimension to it than just as a Transpiler. Please note that though the article talks about TYPE in programming languages in generic, it is also guided by the foundation of typescript.
What is Type in Programming Languages(PL)?
 
According to computer science, Type in languages means, a metadata that describes the kind of data stored in the designated memory location. This metadata can be of predefined primitive datatypes such as integer/float/string or an object (instance of a class). 
Why do we go for Typing?(Strongly Vs Weakly and Static Vs Dynamic Typed)
Strong typing doesn’t allow mixing operations between mismatched data types. This allows to eliminate the runtime errors during static time or compile time. C# and JAVA are languages that support strong typing and hence static type checked. And Javascript is a weakly typed language and hence dynamically type checked. In languages like C#/JAVA a expression like this [1+”1”] yields a static error, pointing out that an explicit casting should fix the expression, like [1+(int)”1”=2]. On the other hand, weakly typed languages like Javascript, expression like [1+”1”] results in implicit casting of the right hand operand to int as 1, and yields a result as 2(integer). Though there are programming languages which have been allowing Gradual Typing, which means, parts of the program allow dynamically typed and other parts allow statically typed to coexist in the same language side by side.Typescript is one such language. Conversely, C# started as a statically typed language, but as of version 4.0 is gradually typed, allowing variables to be explicitly marked as dynamic by using the dynamic type.
Conclusion
 
Typescript is a superset of Javascript in the sense that the lacuna and frailty of javascript are amended in the super language. Javascript was never intended to be enterprise or industry ready, thats were features like gradual typing can bridge the gap and make it powerful. In the next coming series, we will take a look at Sub Type, Duck Type and Nominal Vs Structural Typing, again in the background of Typescript.
Through coding, we imitate god, which makes us not powerful but humble!

Leave a comment