You are on page 1of 3

A.

Intro
a. Types
i. Static checked at compile-time (Java, Haskell) - efficient
ii. Dynamic not checked until runtime, dont have to declare
(Python, Scheme) secure, flexible
iii. Inferred
b. Scope
i. Lexical
ii. Dynamic
B. Saferty
a. Type Safety no bad behavior due to discrepancy b/w differing data
types
i. Coding
1. Operation works on strings, but int passed = segfault
2. Memcpy allows larger array to override smaller array
b. Memory Safety avoid jumps to invalid data addresses and
manipulation of code addresses
i. Rules:
1. No variable in stack references uninitialized object (cant
deref null)
2. No variable in stack references object whose lifetime is
shorter
3. All references respect permissions
ii. Coding
1. C can deref a null pointer
2. Java uses EXCEPTIONS to recover
3. Function g overwrite stack to execute malware
c. Thread Safety can be used without multiple threads interfering
i. Coding
1. Pthread_mutex_lock operation unlock
2. Keep local and global sum (use (i) when adding to global
sum)
3. _sync_fetch_and_add to update global sum
C. Call-By-XXX
a. Call-by-value - copies of values of actual params passed and actual
params not affected by function (uses temp,)
b. Call-by-value-result copies of values of params passed and actual
params not affected by function until function returns (uses temp
and *)
c. Call-by-reference address of actual param passed variable
always accessed through its address so current value always
referenced (not using temps, using *)
d. Call-by-name function that computes value of actual parameter is
passed to the call function
D. Storage

E.

F.

G.
H.

I.
J.
K.

a. Stack Store states of subroutines that are suspended (multithreaded programs have > 1 indep stacks) temporary, local
b. Heap Store all variables that are alive = tree of stacks global
Types of Langs
a. Imperative (C, Java) fast, incremental changes in state (but side
effects, performance in cloud)
b. Procedural (C) Imperative, but using procedures or functions
c. Object Oriented (Java, Schema) Polymorphism, callbacks,
interfaces (but verbose, large API)
d. Functional (Scheme, Haskell) no side effects, lambda, procedures
are data
e. Declarative (Prolog, Cryptol) low side effects, used for modeling
(but no control structures used in coding)
JAVA
a. Imperative
b. Object-Oriented
c. Polymorphism, virtual functions
d. Statically typed
e. Not type safe
f. Primitive types are first class objects
g. Reflection
h. Lambda introduced
i. No need copy constructor (only primitives are copied when calling
method)
j. Garbage collection
i. Pros no misplaced pointers, no double deletions, no wasted
space
ii. Cons takes time, causes non-deterministic behavior
sometimes
k. Nearly memory safe
l. Allocation via stack and heap
m. Threads run independent stacks
n. Statically scoped
o. Call-by-value
p. Applicative order of eval left to right
Virtual Functions
a. Reuse code
b. LAB
Threads
a. Producer/consumer
b. Synch/notify/wait
c. Mutex no synchronization
d. Semaphore more synchronization
Generics
Reflection
SCHEME

L.
M.
N.
O.

a. Not imperative
b. Object oriented with lambda
c. Not really polymorphism
d. Dynamically typed
e. Type safe
f. Closures
g. No real pointers
h. Garbage collection
i. Memory safe
j. Collateral computation with heap
k. Lexically scoped
l. Call by value
m. Applicative order
Lambda
Delay/Force
Infinite lists
More scheme
a. Let defines for the are between parenthesis (shorter scope)
b. Define defines for the whole function
c. Set! sets the value
d. Lambda generates procedures, must have two ( before lambda
e. Continuations return infinite but as a procedure so you can
access as many of it as you want
f. Y-combinator procedure procedure
g. Delay and force use lambda to return a procedure

You might also like