Variables and bindings

  1. Things to consider when designing variable names
    • Length (max, min)
    • Case sensitivity
    • Type/form
  2. Non case-sensitive languages
    Pascal, basic
  3. Examples of case sensitive languages
    Java, C++
  4. Characters with name length limits
    • COBOL (30)
    • FORTRAN 95 (31)
  5. (six) Attributes associated with a variable
    • Name
    • Address
    • Type
    • Value
    • Lifetime
    • Scope
  6. Examples of variables that don't have names
    Arrays
  7. Alias
    • An alias if a¬†variable with a different name, that points to the same memory location
    • Pointers, references and unions are examples of aliases
    • Aliases hurt readability
  8. Types of binding
    • Static - Binding occurs before program runtime and remains unchanged
    • Dynamic - Binding occurs during program runtime and can change during runtime
  9. Types of static type binding
    • Explicit
    • Implicit
  10. How are explicit types declared
    Either with a type, or an expression before the identifier
  11. How are implicit types declared?
    • Default conventions (i.e variables that begin with certain letters will have specific types)
    • Don't need a type identifier
  12. FORTRAN's declaration type
    • Implicit
    • Variables beginning with I, J, K, L, M or N (and lowercase too) are integers
    • Other variables are real numbers
  13. Perl declaration type
    • Implicit
    • $var is a scalar
    • @var is an array
    • %var is a hash structure
  14. Type bindings for implicit and explicit declarations
    Static
  15. Types of type binding
    • Static
    • Dynamic
Author
Ant
ID
354808
Card Set
Variables and bindings
Description
variable
Updated