begin, declarations and expressions 
Author Message
 begin, declarations and expressions

  Concerning the discussion about the two forms of begin, how do you
write a macro that evaluates to something like:

(define a ...)
(set! a ...)

  Are there any good reasons for not allowing declarations in a
(sequencing) begin?  (By the way, I seem to remember that the
rewriting rules in R4RS, ch. 7, define begin as lambda, and therefore
allow declarations in a sequencing begin; is it an error?).
                                J. Chroboczek



Fri, 18 Oct 1996 00:26:31 GMT  
 begin, declarations and expressions
Subject: begin, declarations and expressions

Date: 1 May 1994 16:26:31 GMT

Quote:

>  Concerning the discussion about the two forms of begin,
how do you
>write a macro that evaluates to something like:

>(define a ...)
>(set! a ...)

The primary problem is {yet again!} the difference between
top-level and
internal defines.

  (define a ...)
  (set! a ...)
  (define b ...)
  (set! b ...)
is meaningful in a top-level environment, but you can't do
the trivial transformation into a letrec {to preserve the
semantics} in
internal definitions.  So the real tension is between the
top-level
DEFINE form and the internal DEFINE form which looks the
same but is
logically just syntactic sugar for LETREC.

This [1] means that you have to be aware of context
(top-level or not) =>
good bye referential transparency, and [2] you can't write a
macro to use
multiple value returns to do lexically scoped parallel
definitions
{except in the top-level environment}.

This *is* a real pain.  Given the body of existing code,
however, it is
difficult to fix.

Cheers,
-Ken



Sat, 19 Oct 1996 00:52:24 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. rationale for required expressions for BEGIN and LET(*)

2. signal declaration into package declaration

3. f2c error: Declaration error declaration among executables

4. PGF90-S-0087-Non-constant expression where constant expression required

5. PGF90-S-0087-Non-constant expression where constant expression required

6. Non-constant expression where constant expression required.

7. IF { EXPRESSION or EXPRESSION }

8. translate mathematics expressions to lisp expressions

9. PyKyra 0.1.0 the "Begin in the beginning, the King said" release

10. Which book should I begin with?

11. Beginning to Programm Assembler on Mainframes

12. Beginning with SmallTalk

 

 
Powered by phpBB® Forum Software