Intro Flashcards
What is a type System?
A set of rules to assign a property called a type to the constructs of a computer program.
What is the main purpose of a type system?
Reduce possibilities for bugs.
How does a type System prevent bugs in a computer program?
By defining interfaces between the parts of the computer program.
How type Systems check that the parts have been conected in a consistent way?
Statically ( at compile time )
Dynamically ( at run time )
or… a combination of Both
What is typeScript?
A strict superset of Javascript that adds optional static typing to the lenguage.
What are the two main goals of TypeScript?
- Provide an optional type system for JavaScript.
- Provide planned features from future JavaScript editions to current JavaScript engines.
Why add types to JavaScript?
Types have proven ability to enhance code quality and understandability.
What is refactoring?
Improving the design of existing code.
Why is that Types are one of the best forms of documentation you can have?
Because The function signature is a theorem and the function body is the proof.
TypeScript is Javascript?
False. Typescript is a superset of Javascript.
Why is type inference well motivated?
Typescript do this to give type safety.
Why types can be implicit?
Typescript will infer a type if is not specified, but it cannot be change in the future.
Why would Typescript use annotations?
- To document stuff and read later in the code.
- To match the developer understanding with the compiler understanding of the algorithm.
Why types can be Explicit?
Because we can strongly specify the types manually in the interfaces of the program.
What is nominally?
In name only, perhaps not in reality.