Bookmark the Dictionary of Words Online

referential transparency definition from the Dictionary of Words

Home Contact us New words
Web Images MP3/Audio Video Directory News
Help
Terms of Service
RESULTS IN:    English Spanish

Found 1 hit - Term: referential transparency, Database: *, Strategy: prefix
[1] : The Free On-line Dictionary of Computing (27 SEP 03)
referential transparency
     
         an expression e is referentially transparent if
        any subexpression and its value the result of evaluating it
        can be interchanged without changing the value of e.  this is
        not the case if the value of an expression depends on global
        state which can change value.  the most common example of
        changing global state is assignment to a global variable.  for
        example, if y is a global variable in:
     
        	fx
        	 return x+y; 
     
        	gz
        	
        	  a = f1;
        	  y = y + z;
        	  return a + f1;
        	
     
        function g has the "side-effect" that it alters the value of
        y.  since f's result depends on y, the two calls to f1 will
        return different results even though the argument is the same.
        thus f is not referentially transparent.  changing the order
        of evaluation of the statements in g will change its result.
     
        pure functional languages achieve referential transparency
        by forbidding assignment to global variables.  each
        expression is a constant or a function application whose
        evaluation has no side-effect, it only returns a value and
        that value depends only on the definition of the function and
        the values of its arguments.
     
        we could make f above referentially transparent by passing in
        y as an argument:
     
        	fx, y = x+y
     
        similarly, g would need to take y as an argument and return
        its new value as part of the result:
     
        	gz, y
        	
        	  a = f1, y;
        	  y' = y+z;
        	  return a + f1, y', y';
        	
     
        referentially transparent programs are more amenable to
        formal methods and easier to reason about because the
        meaning of an expression depends only on the meaning of its
        subexpressions and not on the order of evaluation or
        side-effects of other expressions.
     
        we can stretch the concept of referential transparency to
        include input and output if we consider the whole program to
        be a function from its input to its output.  the program as a
        whole is referentially transparent because it will always
        produce the same output when given the same input.  this is
        stretching the concept because the program's input may include
        what the user types, the content of certain files or even the
        time of day.  if we do not consider global state like the
        contents of files as input, then writing to a file and reading
        what was written behaves just like assignment to a global
        variable.  however, if we must consider the state of the
        universe as an input rather than global state then any
        deterministic system would be referentially transparent
     
        see also extensional equality, observational equivalence.
     
        1997-03-25
     
     
see also:
 return x+y;   a = f1; y = y + z; return a + f1;  side-effect pure functional languages assignment  a = f1, y; y' = y+z; return a + f1, y', y';  
formal methods deterministic extensional equality observational equivalence 

Results 1 - 2 of 2 found about referential transparency:

Transparency >> T Words
Transparency, definition of term: Transparency
transparency_pag1.html

Referential >> R Words
Referential, definition of term: Referential
referential_pag1.html


Last accessed:2008/09/06 01:53:04 [Total processing time: 0 seconds]
Myspace Layouts for Girls My Space
Middle East Business España México Puerto Rico Costa Rica Argentina Directorio
Dictionary online database provided by dict.org