Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!hp4nl!alchemy!nico From: nico@cs.ruu.nl (Nico Verwer) Newsgroups: comp.lang.functional Subject: Re: Help needed with behaviour of SML (its interactive system) Message-ID: <1991May16.130335.1596@cs.ruu.nl> Date: 16 May 91 13:03:35 GMT References: <9104262016.AA28063@enuxha.eas.asu.edu> <20644@ogicse.ogi.edu> Organization: Utrecht University, Dept. of Computer Science Lines: 42 In kers@hplb.hpl.hp.com (Chris Dollin) writes: >Clearly if the new definition does not ascribe the same type as the old one, >the inconsistency must be resolved some way; for example, the definition could >be disallowed (yuk) or a new variable could be created (and the old one >assigned a value such as "\x. error 'obsolete function called", and maybe all >using functions tagged as obsolete). Disallowing the definition is obviously not a good idea. Discarding the old binding is better, but static scoping (like ML does) improves on this, by not binding the old definition to "\x. error", but hiding it. >Clearly redefining "sin" (Nico's later example) would be a Bad Thing. This just >means that we need some way of annotating those names no longer available for >redefinition - no big deal. But sometimes I really want to redefine a definition. One of the features of teX (which supports dynamic scoping through macro substitution) which drives me crazy is that I sometimes cannot define a command by \newcommand{\name}{body} because it already exists --- it is annotated as "no longer available for definition". I then have to use \renewcommand{\name}{body} but that is potentially dangerous. Suppose I am a novice LaTeX user, writing a paper on scoping in ML, and I want to define a command \let for typesetting programs which use let ... = ... in ... ; LaTeX complains when the I say \newcommand{\let}{...}. Now I know much about ML (remember this is only an example!) but little about TeX (he I don't even know about the difference between TeX/LaTeX). I therefore say \renewcommand{\let}{...}, with disastrous results. The problem is that TeX uses its own \let, which I don't need, and that I want to use my own \let, and I don't want to give it another name. Marking the old \let is just as bad as \renewcommand-ing it. The only solution here really is static scoping! There is a discussion about scoping in TeX on comp.text.tex at the moment. If only TeX would scope like ML... -- Nico Verwer | nico@cs.ruu.nl Dept. of Computer Science, University of Utrecht | phone: +31 30 533921 p.o. box 80.089, 3508 TB Utrecht, The Netherlands | fax: +31 30 513791