DEFINEs within BEGINs 
Author Message
 DEFINEs within BEGINs

Text item: Text_1


        The IEEE standard for Scheme specifies that begin
        can contain either a list of definitions or a list
        of expressions, but not both. Is that really what
        was intended, or is the standard in error?

I believe this is what was intended. BEGIN with a list of DEFINEs is
useful for macros that have to create more than one definition. Since a
macro form cannot expand into more than one form, it can expand into a
BEGIN form that has more than one DEFINE forms.

BEGIN with a mix of DEFINEs and expressions is of questionable value.
(At least I question it.) Mainly since BEGIN does not otherwise create a
new scope, and LET et. al can do the same thing.





Mon, 14 Oct 1996 23:53:58 GMT  
 DEFINEs within BEGINs
Since a (begin ...) is itself an expression, I guess

   (begin (begin (define ...) ...) expr ...)

would be an obvious work-around.

I don't like the provided 'begin', though - it's messy (really two forms),
and counterintuitive (no corresponding 'end').  Why did 'sequence' ever
change into 'begin'?  What about 'block' or some such name?



Tue, 15 Oct 1996 05:08:08 GMT  
 DEFINEs within BEGINs

   Since a (begin ...) is itself an expression, I guess

      (begin (begin (define ...) ...) expr ...)

   would be an obvious work-around.

Why obvious?  In fact, it doesn't work.  The inner ``begin'' form is
syntactically a definition, which is not legal at the beginning of the
outer ``begin'' form.  (begin ...) is an expression if and only if ...
is a sequence of expressions.  No definitions allowed here.

   I don't like the provided 'begin', though - it's messy (really two forms),
   and counterintuitive (no corresponding 'end').  Why did 'sequence' ever
   change into 'begin'?  What about 'block' or some such name?

I agree with you here.

--
-Matthias



Tue, 15 Oct 1996 22:44:06 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Why not allow define after begin?

2. APL2: How to send a System Command from within a user defined

3. Printing a local defined report from within a window procedure

4. define a attachment within the START command

5. defining structs within a let clause

6. Accessing self defined global variables within a function

7. defining classes within loops?

8. Recursive function defined within function => NameError

9. exceptions within user-defined functions?

10. How to define a bitmap within a script?

11. Can TPB be defined outside defining modules?

12. shadows of define and define-syntax

 

 
Powered by phpBB® Forum Software