Re: [racket-users] try a new macro expander

2015-06-29 Thread Matthew Flatt
Thanks! I've pushed repairs for these problems, mreged recent changes
from the main development branches, and updated the snapshot here:

 http://www.cs.utah.edu/~mflatt/tmp/scope-snapshot/

At Thu, 25 Jun 2015 13:56:04 -0400, Alexander D. Knauth wrote:
 Another weird error:
 #lang racket/base
 (require racket/stxparam (for-syntax racket/base))
 (define-syntax-parameter add (make-rename-transformer #'+))
 (define-syntax add1 (make-rename-transformer #'add))
 add1
 
 ;add1: identifier's binding is ambiguous
 ;  context.:
 ;  matching binding.:
 ;  matching binding.:
 ;  = add context.:
 ;  = add matching binding.:
 ;  matching binding.: in: add1
 
 I found this because of this Travis CI build failure:
 https://travis-ci.org/AlexKnauth/infix-macro/jobs/68245124#L164
 
 On Jun 25, 2015, at 12:31 AM, Matthew Flatt mfl...@cs.utah.edu wrote:
 
  Yes, I overlooked `splicing-local`, and I'll repair it. Thanks for the
  report!
  
  At Wed, 24 Jun 2015 20:27:39 -0400, Alexander D. Knauth wrote:
  I’ve just found something that I expected to work, but didn’t:
  
  #lang racket/base
  (require racket/splicing (for-syntax racket/base))
  (splicing-local
 [(define x 1)]
   (define-syntax outer-x (make-rename-transformer #'x)))
  outer-x
  
  ;. outer-x: unbound identifier in module in: outer-x
  
  This works in the current expander, but fails in the scope-set expander.
  
  It does work for splicing-let and splicing-letrec though.
  
  I found it because I rely on it in this macro here:
  https://github.com/AlexKnauth/my-object/blob/master/my-object/stuff.rkt#L25
  And Travis CI was giving me this error:
  https://travis-ci.org/AlexKnauth/my-object/jobs/68248192#L209
  
  On Jun 22, 2015, at 8:25 AM, Matthew Flatt mfl...@cs.utah.edu wrote:
  
  At Thu, 21 May 2015 07:15:14 -0600, Matthew Flatt wrote:
  Otherwise, be prepared for me to come back in a few
  weeks and lobby for moving to a new macro expander.
  
  Here's the proposal: let's switch on July 16. Switch means that I'd
  merge the new macro expander to the master branch of the development
  repository.
  
  Thanks to those who have tried the new expander and reported back!
  Meanwhile, I've expanded the write-up and filled out the formal model
  (at the same URL as before).
  
  
  -- 
  You received this message because you are subscribed to the Google Groups 
  Racket Users group.
  To unsubscribe from this group and stop receiving emails from it, send an 
  email to racket-users+unsubscr...@googlegroups.com.
  For more options, visit https://groups.google.com/d/optout.
  
  -- 
  You received this message because you are subscribed to the Google Groups 
 Racket Users group.
  To unsubscribe from this group and stop receiving emails from it, send an 
 email to racket-users+unsubscr...@googlegroups.com.
  For more options, visit https://groups.google.com/d/optout.
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Racket Users group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to racket-users+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] try a new macro expander

2015-06-29 Thread Greg Hendershott
Oops, didn't Cc list:

On Mon, Jun 29, 2015 at 12:13 PM, Greg Hendershott
greghendersh...@gmail.com wrote:
 On Mon, Jun 29, 2015 at 7:43 AM, Matthew Flatt mfl...@cs.utah.edu wrote:
 I'll have to update the version number, so there's now a

racket-current-x86_64-linux.sh

 installer link.

 Thanks. Updated to use this:

 https://github.com/greghendershott/travis-racket/commit/5e4d01720497bac37e8f9e522253c9b778a64b5a

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] try a new macro expander

2015-06-25 Thread Alexander D. Knauth
Another weird error:
#lang racket/base
(require racket/stxparam (for-syntax racket/base))
(define-syntax-parameter add (make-rename-transformer #'+))
(define-syntax add1 (make-rename-transformer #'add))
add1

;add1: identifier's binding is ambiguous
;  context.:
;  matching binding.:
;  matching binding.:
;  = add context.:
;  = add matching binding.:
;  matching binding.: in: add1

I found this because of this Travis CI build failure:
https://travis-ci.org/AlexKnauth/infix-macro/jobs/68245124#L164

On Jun 25, 2015, at 12:31 AM, Matthew Flatt mfl...@cs.utah.edu wrote:

 Yes, I overlooked `splicing-local`, and I'll repair it. Thanks for the
 report!
 
 At Wed, 24 Jun 2015 20:27:39 -0400, Alexander D. Knauth wrote:
 I’ve just found something that I expected to work, but didn’t:
 
 #lang racket/base
 (require racket/splicing (for-syntax racket/base))
 (splicing-local
[(define x 1)]
  (define-syntax outer-x (make-rename-transformer #'x)))
 outer-x
 
 ;. outer-x: unbound identifier in module in: outer-x
 
 This works in the current expander, but fails in the scope-set expander.
 
 It does work for splicing-let and splicing-letrec though.
 
 I found it because I rely on it in this macro here:
 https://github.com/AlexKnauth/my-object/blob/master/my-object/stuff.rkt#L25
 And Travis CI was giving me this error:
 https://travis-ci.org/AlexKnauth/my-object/jobs/68248192#L209
 
 On Jun 22, 2015, at 8:25 AM, Matthew Flatt mfl...@cs.utah.edu wrote:
 
 At Thu, 21 May 2015 07:15:14 -0600, Matthew Flatt wrote:
 Otherwise, be prepared for me to come back in a few
 weeks and lobby for moving to a new macro expander.
 
 Here's the proposal: let's switch on July 16. Switch means that I'd
 merge the new macro expander to the master branch of the development
 repository.
 
 Thanks to those who have tried the new expander and reported back!
 Meanwhile, I've expanded the write-up and filled out the formal model
 (at the same URL as before).
 
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Racket Users group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to racket-users+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Racket Users group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to racket-users+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] try a new macro expander

2015-06-24 Thread Alexander D. Knauth
I’ve just found something that I expected to work, but didn’t:

#lang racket/base
(require racket/splicing (for-syntax racket/base))
(splicing-local
[(define x 1)]
  (define-syntax outer-x (make-rename-transformer #'x)))
outer-x

;. outer-x: unbound identifier in module in: outer-x

This works in the current expander, but fails in the scope-set expander.

It does work for splicing-let and splicing-letrec though.

I found it because I rely on it in this macro here:
https://github.com/AlexKnauth/my-object/blob/master/my-object/stuff.rkt#L25
And Travis CI was giving me this error:
https://travis-ci.org/AlexKnauth/my-object/jobs/68248192#L209

On Jun 22, 2015, at 8:25 AM, Matthew Flatt mfl...@cs.utah.edu wrote:

 At Thu, 21 May 2015 07:15:14 -0600, Matthew Flatt wrote:
 Otherwise, be prepared for me to come back in a few
 weeks and lobby for moving to a new macro expander.
 
 Here's the proposal: let's switch on July 16. Switch means that I'd
 merge the new macro expander to the master branch of the development
 repository.
 
 Thanks to those who have tried the new expander and reported back!
 Meanwhile, I've expanded the write-up and filled out the formal model
 (at the same URL as before).


-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] try a new macro expander

2015-06-24 Thread Matthew Flatt
Yes, I overlooked `splicing-local`, and I'll repair it. Thanks for the
report!

At Wed, 24 Jun 2015 20:27:39 -0400, Alexander D. Knauth wrote:
 I’ve just found something that I expected to work, but didn’t:
 
 #lang racket/base
 (require racket/splicing (for-syntax racket/base))
 (splicing-local
 [(define x 1)]
   (define-syntax outer-x (make-rename-transformer #'x)))
 outer-x
 
 ;. outer-x: unbound identifier in module in: outer-x
 
 This works in the current expander, but fails in the scope-set expander.
 
 It does work for splicing-let and splicing-letrec though.
 
 I found it because I rely on it in this macro here:
 https://github.com/AlexKnauth/my-object/blob/master/my-object/stuff.rkt#L25
 And Travis CI was giving me this error:
 https://travis-ci.org/AlexKnauth/my-object/jobs/68248192#L209
 
 On Jun 22, 2015, at 8:25 AM, Matthew Flatt mfl...@cs.utah.edu wrote:
 
  At Thu, 21 May 2015 07:15:14 -0600, Matthew Flatt wrote:
  Otherwise, be prepared for me to come back in a few
  weeks and lobby for moving to a new macro expander.
  
  Here's the proposal: let's switch on July 16. Switch means that I'd
  merge the new macro expander to the master branch of the development
  repository.
  
  Thanks to those who have tried the new expander and reported back!
  Meanwhile, I've expanded the write-up and filled out the formal model
  (at the same URL as before).
 
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Racket Users group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to racket-users+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] try a new macro expander

2015-06-23 Thread Neil Toronto

On 06/22/2015 08:25 AM, Matthew Flatt wrote:

At Thu, 21 May 2015 07:15:14 -0600, Matthew Flatt wrote:

Otherwise, be prepared for me to come back in a few
weeks and lobby for moving to a new macro expander.


Here's the proposal: let's switch on July 16. Switch means that I'd
merge the new macro expander to the master branch of the development
repository.


Perhaps a mixture of excitement and trepidation is stifling replies. :)

+10. I'm really looking forward to it.

Neil ⊥

--
You received this message because you are subscribed to the Google Groups Racket 
Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] try a new macro expander

2015-06-23 Thread Robby Findler
Excited!

On Tue, Jun 23, 2015 at 10:30 AM, Neil Toronto neil.toro...@gmail.com wrote:
 On 06/22/2015 08:25 AM, Matthew Flatt wrote:

 At Thu, 21 May 2015 07:15:14 -0600, Matthew Flatt wrote:

 Otherwise, be prepared for me to come back in a few
 weeks and lobby for moving to a new macro expander.


 Here's the proposal: let's switch on July 16. Switch means that I'd
 merge the new macro expander to the master branch of the development
 repository.


 Perhaps a mixture of excitement and trepidation is stifling replies. :)

 +10. I'm really looking forward to it.

 Neil ⊥


 --
 You received this message because you are subscribed to the Google Groups
 Racket Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to racket-users+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] try a new macro expander

2015-06-23 Thread Anthony Carrico
. Awesome that Racket keeps pushing the envelope on
meta-programming. It /is/ exciting. I'm somewhat quiet because I'm still
absorbing it as I get the time. There has been chatter on IRC too. Also,
very cool that mflatt is being so open with the community during the dev
cycle. Bring it on.

-- 
Anthony Carrico


-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Re: [racket-users] try a new macro expander

2015-06-22 Thread Matthew Flatt
At Thu, 21 May 2015 07:15:14 -0600, Matthew Flatt wrote:
 Otherwise, be prepared for me to come back in a few
 weeks and lobby for moving to a new macro expander.

Here's the proposal: let's switch on July 16. Switch means that I'd
merge the new macro expander to the master branch of the development
repository.

Thanks to those who have tried the new expander and reported back!
Meanwhile, I've expanded the write-up and filled out the formal model
(at the same URL as before).

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] try a new macro expander

2015-05-22 Thread Matthew Flatt
At Thu, 21 May 2015 22:58:04 -0400, Josh Grams wrote:
 Also, shouldn't the x's under syntax-rules and in the expansion of
 (m) have a 'b' in their scope sets (since they're in the
 syntax-rules scope)? Or aren't they?

The `let-syntax` form binds only in its body, not the right-hand sides
of bindings, so that's why there's no `b` on those `x`s.

If the example used `letrec-syntax` instead of `let-syntax`, then `b`
would go on those `x`s.


 - I found the use-site scope argument a little confusing. I got
   it, but it took a while. Labelling the scopes better would
   probably help. But also...I think this probem can occur if you
   invoke the macro from any scope which contains the macro
   definition? There should be some way to make that clear: the
   use-site needs a scope added to ensure that *references* to
   macro arguments are never treated as lexical ancestors, but
   *definitions* of names passed in can (and should) be.

I'm not sure I follow your question, but I think you're referring to
the optimization described in the inset note at the end of the section.

If a macro is used in a context that already has additional scopes
relative to the macro's defining scope, then those additional scopes
can serve the same role as a use-site scope. That is, the use-site
scope would appear on exactly the identifiers that have the additional
scopes, so a use-site scope would be redundant.

As far as the presentation goes, I doubt that the current position of
that note is the right place to discuss the optimization, anyway.


Thanks for your other comments!

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


RE: [racket-users] try a new macro expander

2015-05-22 Thread Jos Koot
Hi Matthew,
Your proposal sounds very good to me (for what my opinion is worth). Thanks.
FWIW I give you my findings, which are positive.
I have tried the snapshot with the tests of three of my systems:
lc-with-redex (not in planet or github)
fmt (on planet)
infix (not yet in planet or github)
In total over a thousand tests.
All succeeded.
infix has a phase nesting level of 3 or 4:
macro definitions within macro definitions and
requires at level 0 and 1 and much depending on free-identifier=?.
No problem.
Some of the tests use fresh namespaces with namespace-requires at relative
level 0 and 1.
No problem either.
I ran all tests in DrRacket, hence times cannot be trusted, but I do not
notice slow down.
Thanks again, Jos
 

-Original Message-
From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com]
On Behalf Of Matthew Flatt
Sent: jueves, 21 de mayo de 2015 15:15
To: us...@racket-lang.org
Subject: [racket-users] try a new macro expander

I've been working on a new model of macros for Racket. The new model
provides a simple account of scope, makes reasoning about macros
easier, and simplifies the implementation of the macro expander while
fixing bugs (e.g., submodules in Typed Racket).

You can read more about the model here:

  http://www.cs.utah.edu/~mflatt/scope-sets-5/

Section 3 includes a download link and a report on how current packages
fare with the new expander:

  http://www.cs.utah.edu/~mflatt/scope-sets-5/implementation.html

As that report shows, most libraries and packages work as-is, but not
all of them work --- and that's counting only code that's registered at
the package catalog.

Unfortunately, we can't support multiple macro languages and keep all
old libraries working unmodified. The change is at the level of syntax
objects and scope representation, which is part of the foundation for
supporting multiple languages, and all Racket languages have to agree
on that part.

Although my experience with the new expander has been positive, I don't
think anyone else has worked with it seriously, yet. Give it a try if
you have time. Otherwise, be prepared for me to come back in a few
weeks and lobby for moving to a new macro expander.

-- 
You received this message because you are subscribed to the Google Groups
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an
email to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] try a new macro expander

2015-05-21 Thread Greg Hendershott
Thanks to a pull request from Alexander Knauth, you can add a
RACKET_VERSION = SCOPE_SNAPSHOT to your .travis.yml build matrix:

  https://github.com/greghendershott/travis-racket/blob/master/.travis.yml#L31

Also, as with RACKET_VERSION = HEAD, you can put this version into an
allowed failures list. That way, it won't ding your overall build
status:

  
https://github.com/greghendershott/travis-racket/blob/master/.travis.yml#L33-L38

On Thu, May 21, 2015 at 9:15 AM, Matthew Flatt mfl...@cs.utah.edu wrote:
 I've been working on a new model of macros for Racket. The new model
 provides a simple account of scope, makes reasoning about macros
 easier, and simplifies the implementation of the macro expander while
 fixing bugs (e.g., submodules in Typed Racket).

 You can read more about the model here:

   http://www.cs.utah.edu/~mflatt/scope-sets-5/

 Section 3 includes a download link and a report on how current packages
 fare with the new expander:

   http://www.cs.utah.edu/~mflatt/scope-sets-5/implementation.html

 As that report shows, most libraries and packages work as-is, but not
 all of them work --- and that's counting only code that's registered at
 the package catalog.

 Unfortunately, we can't support multiple macro languages and keep all
 old libraries working unmodified. The change is at the level of syntax
 objects and scope representation, which is part of the foundation for
 supporting multiple languages, and all Racket languages have to agree
 on that part.

 Although my experience with the new expander has been positive, I don't
 think anyone else has worked with it seriously, yet. Give it a try if
 you have time. Otherwise, be prepared for me to come back in a few
 weeks and lobby for moving to a new macro expander.

 --
 You received this message because you are subscribed to the Google Groups 
 Racket Users group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to racket-users+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] try a new macro expander

2015-05-21 Thread Josh Grams
On 2015-05-21 07:15AM, Matthew Flatt wrote:
I've been working on a new model of macros for Racket.

  http://www.cs.utah.edu/~mflatt/scope-sets-5/

Minor typo in the last paragraph of Section 1.1: insprired.

Also, shouldn't the x's under syntax-rules and in the expansion of
(m) have a 'b' in their scope sets (since they're in the
syntax-rules scope)? Or aren't they?

Overall I found it relatively clear, but (as with much of Racket's
documentation) I felt like the order and the details of the
presentation obscured things a bit. I had to read and re-read
things more times than I would have liked to convince myself that
it all made sense. I'm very new to Racket, so take this with a
grain of salt, but:

- Labelling scopes with the name of the binding form instead of
  letters ({let, let-syntax, lambda} instead of {a, b, c})
  would make it *much* clearer and obviate some of the explanatory
  text.

- I feel like the key idea is that adding a scope makes the inner
  scope sets bigger, and that an identifier refers to the binding
  with the largest subset of the reference's scope set.  I'd put
  that at the very beginning, rather than leaving it until after
  the bit about macro expansion adding a scope. Or at *least* give
  it a heading of its own.

- I found the use-site scope argument a little confusing. I got
  it, but it took a while. Labelling the scopes better would
  probably help. But also...I think this probem can occur if you
  invoke the macro from any scope which contains the macro
  definition? There should be some way to make that clear: the
  use-site needs a scope added to ensure that *references* to
  macro arguments are never treated as lexical ancestors, but
  *definitions* of names passed in can (and should) be.

--Josh

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.