This site is a static rendering of the Trac instance that was used by R7RS-WG1 for its work on R7RS-small (PDF), which was ratified in 2013. For more information, see Home.

Source for ticket #47

cc


    

changetime

2012-10-05 00:37:57

component

WG1 - Macros

description

R6RS extends define-syntax to be allowed
in local lexical contexts.  Do we allow
this as well?

id

47

keywords


    

milestone


    

owner

alexshinn

priority

major

reporter

alexshinn

resolution

fixed

severity


    

status

closed

summary

internal define-syntax

time

2010-03-22 10:19:44

type

defect

Changes

Change at time 2012-10-05 00:37:57

author

cowan

field

comment

newvalue


    

oldvalue

13

raw-time

1349372277328327

ticket

47

time

2012-10-05 00:37:57

Change at time 2012-10-05 00:37:57

author

cowan

field

resolution

newvalue

fixed

oldvalue


    

raw-time

1349372277328327

ticket

47

time

2012-10-05 00:37:57

Change at time 2012-10-05 00:37:57

author

cowan

field

status

newvalue

closed

oldvalue

writing

raw-time

1349372277328327

ticket

47

time

2012-10-05 00:37:57

Change at time 2011-02-26 17:48:51

author

alexshinn

field

comment

newvalue


    

oldvalue

12

raw-time

1298713731000000

ticket

47

time

2011-02-26 17:48:51

Change at time 2011-02-26 17:48:51

author

alexshinn

field

owner

newvalue

alexshinn

oldvalue


    

raw-time

1298713731000000

ticket

47

time

2011-02-26 17:48:51

Change at time 2011-02-26 17:48:51

author

alexshinn

field

status

newvalue

writing

oldvalue

decided

raw-time

1298713731000000

ticket

47

time

2011-02-26 17:48:51

Change at time 2011-01-29 11:34:51

author

alexshinn

field

comment

newvalue


    

oldvalue

11

raw-time

1296272091000000

ticket

47

time

2011-01-29 11:34:51

Change at time 2011-01-29 11:34:51

author

alexshinn

field

status

newvalue

decided

oldvalue

assigned

raw-time

1296272091000000

ticket

47

time

2011-01-29 11:34:51

Change at time 2011-01-29 11:34:41

author

alexshinn

field

comment

newvalue


    

oldvalue

10

raw-time

1296272081000000

ticket

47

time

2011-01-29 11:34:41

Change at time 2011-01-29 11:34:41

author

alexshinn

field

owner

newvalue


    

oldvalue

alexshinn

raw-time

1296272081000000

ticket

47

time

2011-01-29 11:34:41

Change at time 2011-01-29 11:34:41

author

alexshinn

field

status

newvalue

assigned

oldvalue

reopened

raw-time

1296272081000000

ticket

47

time

2011-01-29 11:34:41

Change at time 2011-01-29 11:34:29

author

alexshinn

field

comment

newvalue


    

oldvalue

9

raw-time

1296272069000000

ticket

47

time

2011-01-29 11:34:29

Change at time 2011-01-29 11:34:29

author

alexshinn

field

resolution

newvalue


    

oldvalue

fixed

raw-time

1296272069000000

ticket

47

time

2011-01-29 11:34:29

Change at time 2011-01-29 11:34:29

author

alexshinn

field

status

newvalue

reopened

oldvalue

closed

raw-time

1296272069000000

ticket

47

time

2011-01-29 11:34:29

Change at time 2010-10-18 02:57:58

author

cowan

field

comment

newvalue

The WG voted to accept this feature.

oldvalue

8

raw-time

1287345478000000

ticket

47

time

2010-10-18 02:57:58

Change at time 2010-10-18 02:57:58

author

cowan

field

resolution

newvalue

fixed

oldvalue


    

raw-time

1287345478000000

ticket

47

time

2010-10-18 02:57:58

Change at time 2010-10-18 02:57:58

author

cowan

field

status

newvalue

closed

oldvalue

new

raw-time

1287345478000000

ticket

47

time

2010-10-18 02:57:58

Change at time 2010-05-14 03:18:04

author

arcfide

field

comment

newvalue

While this is convenient, if we are going to avoid dealing with arbitrary code in the meta phase in WG1, we have to be careful about such forms, because we're inviting a situation where we have to start being fuzzy. We can't specify that there is an implicit LET-NIL on the right hand side, because that would allow arbitrary code at the meta phase, which immediately brings in phasing issues. While I'm not opposed to this, we have to be aware of the extra work that it causes. I assume that you're talking purely about allowing DEFINE-SYNTAX in there, but then we have to be careful about forwards compatibility with WG2. 

In other words, I expect that only a limited subset of the potential functionality will be allowed here, and we have to explicitely leave the rest unspecified, this makes things very fuzzy, and is no where near as easy as just changing BEGINs to LET-NILs. 

oldvalue

7

raw-time

1273781884000000

ticket

47

time

2010-05-14 03:18:04

Change at time 2010-05-12 15:03:46

author

medernac

field

comment

newvalue

Sure this is not allowed with define and this is because of lambda shortcut for define that we could put sub-definitions.

{{{
(define (foo arg ...) <definition>* ...)
=>
(define foo (lambda (arg ...) <definition>* ...))
}}}

For syntax-case we have a lambda so there is no problem for nesting. The situation is different with define-syntax and syntax-case (I don't see how to have a similar shortcut). It would be nice to avoid putting a "let ()" for each submacro level defined.

There are many choices, I proposed this one:

{{{
(define-syntax foo
  (define-syntax bar ...))
  (syntax-rules () ...))
}}}

There is also this style:  

{{{
(define-syntax foo  
  (syntax-rules ()
    (define-syntax bar ...))
    ...))
}}}

Among the possible choices I personally prefer the first one as most convenient.

What would make this change more difficult ? One possible implementation would be to flatten internally all macro definition and then to make sure direct calls to submacros make reference to corresponding macros:

{{{
(define-syntax <foo~bar> ...))

(define-syntax foo
;; Direct calls to bar replaced by calls to <foo~bar>
  (syntax-rules () ...))
}}}

oldvalue

6

raw-time

1273651426000000

ticket

47

time

2010-05-12 15:03:46

Change at time 2010-05-12 04:02:47

author

arcfide

field

comment

newvalue

This isn't actually allowed for DEFINE either. Something like

{{{
(define a
  (define b 3)
  b))
}}}

Doesn't work. in R6RS, both DEFINE and DEFINE-SYNTAX in their simple forms expect an identifier followed by an expression. In either case, it's trivial to do something like:

{{{
(define a
  (let ()
    (define b 3)
    b)))
}}}

On the other hand, there is the shortcut with DEFINE that lets you put an implicit lambda there. I am not sure that this is as simple a change, as say, #53.

oldvalue

5

raw-time

1273611767000000

ticket

47

time

2010-05-12 04:02:47

Change at time 2010-05-11 14:06:10

author

medernac

field

comment

newvalue

I mean to allow nested define-syntax like we already have for nested define:

(define-syntax foo
  (define-syntax bar ...)
  ...)

So that bar could be called from foo as a submacro and be visible only by foo.


  

oldvalue

4

raw-time

1273561570000000

ticket

47

time

2010-05-11 14:06:10

Change at time 2010-05-09 05:39:26

author

arcfide

field

comment

newvalue

What do you mean by allowing nested define-syntax? Is this different than the internal define-syntax that is permitted by R6RS?

oldvalue

3

raw-time

1273358366000000

ticket

47

time

2010-05-09 05:39:26

Change at time 2010-05-05 15:40:03

author

medernac

field

comment

newvalue

Why not allowing also nested define-syntax for defining submacros ?

oldvalue

2

raw-time

1273048803000000

ticket

47

time

2010-05-05 15:40:03

Change at time 2010-03-22 12:03:06

author

cowan

field

comment

newvalue

Sounds good to me, on the principle of self-consistency, which the charter says is an important objective.

oldvalue

1

raw-time

1269234186000000

ticket

47

time

2010-03-22 12:03:06