Com S 342 meeting -*- Outline -*- * data or means of computation i.e., means of computation, primitive expressions ** plan *** brainstorming Q: What should be the types in the language? Make two lists: one for the simple types and one for the compound types. Q: How do we know whether we have enough types? (Time and space efficiency, completeness) sum and product types lists as able to simulate both *** condensation Q: How does simplicity affect the list of types? key test is simulation: one type be used to simulate another (or vice versa)? ------------------------------------------ SIMULATION, GENERALITY def: A type T can simulate a type U if using T one can get the same behavior as U. Behavior includes: functionality (inputs, outputs) size (space used) time (complexity of running ops) ------------------------------------------ Q: How do we know whether we have too many types? (User-defined types, simplicity of numeric types) Q: What types should be built-in? Depends on their utility, in efficiency, portability, and whether they need to be used in means of combination (such as Booleans) *** type checking Q: Should there be a static type system, or should there be run-time type checking? ------------------------------------------ TYPE CHECKING AND TYPE ERRORS term: type error def: *dynamic type checking* means type errors are detected (in general) def: *static type checking* means type errors are detected ------------------------------------------ ... at run-time. ... before the program is run. Q: Which is better for users? Q: Which is more flexible? (+ 3 (if (zero? 0) 4 'done)) ; illegal in typed languages Q: Which suits interpreters better? Q: Which gives better performance? (Simplicity, closure) in 2001, decided on dynamic typing. *** summary in 2004: primitive types compound types =================================== number vector (arrays) char (linked) lists ports (files) symbol stream may still need: strings, boolean procedures ** operations Q: What literals, constructors, and observers are needed? Q: Are any special forms (e.g., &&, || in Java) needed? in 2004: operations literals special forms number +, -, *, / 1, 1.2, if <, >, <=,... 5.7e4 char <, >, ... 'a', '\r' vector {1, 2, 3} symbol #asym ** terminology --------------------------------------------------------- TERMINOLOGY special form closure (as in algebraic closure) ---------------------------------------------------------