Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!decwrl!world!iecc!compilers-sender From: cs450a03@uc780.umd.edu (Raul Rockwell) Newsgroups: comp.compilers Subject: RE: Help needed on SML compiler Keywords: ML, functional Message-ID: <27MAR91.08353858@uc780.umd.edu> Date: 27 Mar 91 08:35:38 GMT References: <9103260248.AA22854@enuxha.eas.asu.edu> Sender: compilers-sender@iecc.cambridge.ma.us Reply-To: cs450a03@uc780.umd.edu (Raul Rockwell) Organization: The University of Maryland University College Lines: 32 Approved: compilers@iecc.cambridge.ma.us Surendar Chandra, working on a compiler for a functional language, gives an example that basically runs: define function A use function A redefine function A use function A Which, I think, points out the reason functional language advocates tend to look at reassignment as a totally different operation than assignment. Many would say that reassignment should be unimplemented as much as possible. However, the best way I can see to implement something like the above is to simply say that the last definition of a name is the one which is advertised outside the module. (e.g. given A@1, A@2 and A@3, where @n indicates serial number, use A@3). If the function associated with a name can change on-the-fly, for the same body of code, you'll have to provide an interface for those functions. This might be as simple as a "case statement" or, for ill conditioned code, might be as complex as a call to some generalized function resolver. The case of "redefined on the fly" occurs with the use of global references or where function definition occurs inside a loop (on non-constant data) or where a function's definition depends on I/O (e.g. construct fndef from file). Raul Rockwell -- Send compilers articles to compilers@iecc.cambridge.ma.us or {ima | spdcc | world}!iecc!compilers. Meta-mail to compilers-request.