Newsgroups: comp.lang.scheme
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!howland.reston.ans.net!gatech!psuvax1!news.ecn.bgu.edu!siemens!princeton!news.princeton.edu!blume
From: blume@dynamic.cs.princeton.edu (Matthias Blume)
Subject: Re: letrec* [was: Re: R4RS high level macro question]
In-Reply-To: will@ccs.neu.edu's message of 30 Nov 1994 19:20:47 GMT
Message-ID: <BLUME.94Dec3135513@dynamic.cs.princeton.edu>
Originator: news@hedgehog.Princeton.EDU
Sender: news@Princeton.EDU (USENET News System)
Nntp-Posting-Host: dynamic.cs.princeton.edu
Organization: Princeton University
References: <2WIENBE.94Nov23134611@rzdspc46.informatik.uni-hamburg.de>
	<3b3l1r$9js@xmission.xmission.com>
	<2WIENBE.94Nov25144424@rzdspc46.informatik.uni-hamburg.de>
	<3bijaf$47k@narnia.ccs.neu.edu>
Date: Sat, 3 Dec 1994 18:55:13 GMT
Lines: 43

In article <3bijaf$47k@narnia.ccs.neu.edu> will@ccs.neu.edu (William D Clinger) writes:

   [ very interesting account of the history of internal definitions
     deleted ... ]

   This is the other of the two primary reasons some people like internal
   definitions:  They interact badly with non-hygienic macros, and very
   badly with hygienic macros (although a sufficiently good implementation
   of hygienic macros can hide the additional problems from everyone but
   its exasperated implementors).

This is very well said.  However, being among the ``exasperated''
implementors I must say that I still like internal definitions better.
LETREC just looks ugly, it tends to require more parentheses and
deeper indentation.  This, of course, is just a matter of personal
taste, but nevertheless I consider it important.

The only trouble with internal definitions and macros is that it is
not possible in full generality to find the boundary between
definitions and expressions inside a body.  The way this situation is
fixed right now is that it must be possible to find the boundary (plus
the names being defined locally) without having to expand any
instances of local macro definitions.  This way the system can
translate internal definitions into some form of LETREC combined with
LETREC-SYNTAX (currently we don't have such a combined form).

The problem of finding the boundary could be fixed by making it
syntactically explicit like in:

	(lamda <formals> [ <definition> ... end-definitions ]
	  <expr> <expr> ...)

where END-DEFINITIONS is an auxiliary keyword belonging to LAMBDA's
syntax.  This clearly is ugly, too.  Furthermore, we would still have
the problem with unambiguously identifying the names defined by those
internal definitions.

The current solution seems to be a reasonable tradeoff, and it is not
too hard to implement.  [Of course, my first attempt promptly led to
an exponential-time algorithm due to a simple mistake... :( ]

--
-Matthias
