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 records 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 is simpliest to implement? in Oz: dynamic type checking ** operations Q: What literals, constructors, and observers are needed? Q: Are any special forms (e.g., &&, || in Java) needed? in Oz: operations literals special forms Bool true, false andthen orelse if Int, Float +, -, *, / 1, 1.2, <, >, <=,... 5.7e4 Char <, >, ... &c Atom asym, 'if' Cell := Procedure proc {$ Formals} ... end ** terminology --------------------------------------------------------- TERMINOLOGY special form closure (as in algebraic closure) --------------------------------------------------------- ... a special form is a syntactic abstraction that doesn't necessarily evaluate all of its subexpressions or subcommands ... closure means that the result of applying an operation to elements of a type is another element of that type.