CSCI-GA.3033.003 Scripting Languages

CSCI-GA.3033.003 Scripting Languages

11/14/2013 TypeScript

CS 5142 Cornell University

1

11/14/13

Concepts

Typing

? Strong typing = no implicit type conversion ? Weak typing = implicit type conversion ? Static typing = check for type errors at compile time ? Dynamic typing = check for type errors at run time

CS 5142 Cornell University

2

11/14/13

Concepts

Weak/Strong, Static/Dynamic Typing

Strong typing (explicit conversions)

ML

Java VBA

C

Weak typing (implicit conversions)

assembler

Static typing

(compile-time checks)

CS 5142 Cornell University 11/14/13

Scheme

PHP JavaScript

Perl

Dynamic typing (runtime checks)

3

JavaScript

Unexpected Behavior

$ node > '5' + 2 '52' > '5' - 2 3

$ node > '' == '0' false > 0 == '' true > 0 == '0' true

CS 5142 Cornell University

4

11/14/13

Concepts

Strong Typing

? Makes intention explicit ? Makes code easier to read/maintain ? Can catch certain types of errors ? Less likely to have "unexpected" behavior

CS 5142 Cornell University

5

11/14/13

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download