Friday, January 4, 2008

Some type system jargons

Type system jargons:

----------------------+------------------------------+-----------------------
Yes                   |                              |  No
----------------------+------------------------------+-----------------------
Manifest              |                              |  Latent
                      | explicit type declaration    |
`int a = 1`           |                              |  `a = 1`
                      |                              |
----------------------+------------------------------+-----------------------
Static                |                              |  Dynamic
                      | AST node has type            |
                      | (note AST is built during    |
                      |  compilation)                |
`a + 2`               |                              |  `a + 2`
already is Int        |                              |  is evaluated to 3
during compilation    |                              |  during runtime
                      |                              |  and gets type Int
                      |                              |
----------------------+------------------------------+-----------------------
Weak                  |                              |  Strong
                      | type coercion                |
`print 2`             |                              |  `print (String)2`
Int is automatically  |                              |  Int is explicitly
coerced to String     |                              |  converted to String
                      |                              |
----------------------+------------------------------+-----------------------
Nominative            |                              |  Structural
                      | type compatibility decleared |
                      | explicitly                   |
`class C extends B`   |                              |  `class C { x, y }`
C is compatible to B  |                              |  `class B { x }`
because it is         |                              |  C is compatible
explicitly            |                              |  to B because it
declared to extend B  |                              |  has similar
                      |                              |  structure
----------------------+------------------------------+-----------------------

No comments:

Post a Comment