20-CS-4003-001 Organization of Programming Languages Fall 2017
Scheme Properties

Lambda calculus, Type theory, Formal semantics, Program analysis

    Prev     Next     All lectures

Scheme Properties

   
Not Imperative (w/ exceptions)
    good:
    no side effects (except when set! and such are used)
uses lambda - students don't like it
bad:
loss of speed compared to imperative paradigm
students don't like nested levels of parens
 
Object-oriented via lambda
    good:
    see closures below
    speed to a (semi) working product is even better than for Java
    needed language reference is one sheet of paper - Java requires reams
    procedures (expressions) tend to be incredibly short
    not so good:
    to be determined
 
Polymorphism is not really developed
    good:
    depends on point of view - OK if dynamic typing is preferred
    bad:
    analyzing code for security problems is harder
 
Dynamically typed
    good:
    improved expressibility and flexibility over Java - examples to follow
    not so good:
    many type errors are not found at compile time
    more type checking is done at runtime hindering performance
 
Type safe
   the absence of erroneous or undesirable behavior caused by a
   discrepancy between differing data types
    not so bad:
    type safety is enforced at runtime
 
Functions are first class objects
  1. can be assigned a value
  2. can be composed with other entities in composites ((lambda (x) ((lambda (y) (+ x y)) 2)) 3)
  3. can be passed as an argument to a function
  4. can be returned as a function result
 
Closures support impressive applications
   a function and environment containing free variables which can be carried as an object
   to other points of code where the function can be executed while referencing the free
   and bound variables of the environment
    good:
    continuation passing style - tail recursion
    currying
    novel forms of control without side-effects are possible
    Y combinator - no function, even recursive, needs to be named
    bad:
    many students complain about too many lambdas and parens
    many students can't appreciate how closures hide state
    many students don't realize that closures are not anonymous functions
 
No real concept of pointers
   functions have values when invoked
    good:
    pointers are not part of a specification and can cause trouble
    bad:
    nothing really
 
Has garbage collection
    good:
    space is reclaimed
    wasted, unreferenced, unused space is reduced or eliminated
    bad:
    garbage collection may take a significant amount of time
 
Memory safe
    good:
    memory is not leaked, no buffer overflow, etc.
    bad:
    stack overflow is possible
 
Collateral computation via heap
   tree of stacks
    good:
    extends exceptions in a semantically logical way
    supports call-with-current-continuation
    no deadlock problem
    no worry about synchronization
    bad:
    nothing really
 
Lexically scoped
   the scope of a declaration is the region of the program where that variable can be referenced
    good:
    scope is known at compile time and can be completely determined from the text of the code.
    application programmer understands scope as it is made clear in the syntax of the language through ( and ), for example.
    not so bad:
    loss of flexibility - e.g. set up display variable at some particular point of execution, then reference it from anywhere later
 
Call-by-value
    good:
    understood semantics - chance of verifying or validating correctness is increased because less about what is happening inside the function is known to or accessible by the caller.
    hmmm:
    but only references to objects are passed instead of the objects
    not too bad:
    loss of flexibility - e.g. call-by-name, value-result, etc. are not available but this can be worked around.
 
Applicative order evaluation of parameters, left to right
   reduces terms within a function body as much as possible before
   the function is applied
 
Strict evaluation of parameters
   all parameters are evaluated before entering body