Re: [racket-users] Macro introduce identifiers in the new expander

2015-07-21 Thread Spencer Florence
That fixed the example I gave, but now this fails:

(let ()
  (def)
  (let ()
(use)))

On Mon, Jul 20, 2015 at 2:50 PM Matthew Flatt mfl...@cs.utah.edu wrote:

 Repair pushed.



  On Jul 20, 2015, at 11:14 AM, Matthew Flatt mfl...@cs.utah.edu wrote:
 
  Thanks for the info. I think it's a bug in the expander, and I have a
  repair, but I think that repair might point to another bug that I'm
  still investigating.
 
  At Mon, 20 Jul 2015 12:56:49 -0400, Alexander D. Knauth wrote:
  I don't really know what's going on, but this might help:
 
  ;; It seems to be introducing the definition correctly, but not the use:
  ;; this works
  (let ()
   (def) ; no difference between (def) and (define id 5)
   id)
 
  ;; this doesn't
  (let ()
   (def)
   (use)) ; but there is a difference between (use) and id
 
  ;; and this doesn't either
  (let ()
   (define id 5)
   (use))
 
  On Jul 20, 2015, at 12:35 PM, Spencer Florence spen...@florence.io
 wrote:
 
  Hello,
 
  I'm trying to update some code to the new expander. The below code
 works on
  6.2 but fails on the new expander with an unbound identifier error.
 
  #lang racket
  (require (for-syntax syntax/parse))
 
  ;; a standard context for identifiers
  (define-for-syntax ctx #'ctx)
 
  ;; create an ID with the context `ctx`, and the current
  ;; expander mark (so that the mark is canceled later),
  ;; and the location loc
  (define-for-syntax (make-id loc)
   (syntax-local-introduce
(datum-syntax ctx 'id loc)))
 
  ;; This introduces a binding
  (define-syntax (def stx)
   (syntax-parse stx
 [(def)
  (with-syntax ([id (make-id #'here)])
#'(define id 5))]))
 
  ;; this attempts to use the binding introduced by `def`
  (define-syntax (use stx)
   (syntax-parse stx
 [(use)
  (with-syntax ([id (make-id #'here)])
#'id)]))
 
  ;; this works
  #;
  (begin
   (def)
   (use))
 
  ;; this fails
  (let ()
   (def)
   (use))
 
  --
  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.


-- 
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] Macro introduce identifiers in the new expander

2015-07-21 Thread Matthew Flatt
That one should fail (and the same as with the old expander).

Each `(let () )` starts a new scope, and the identifier introduced
by `(use)` doesn't have the scope for the outer `(let () )` where
`(def)` creates a binding.

At Tue, 21 Jul 2015 19:38:57 +, Spencer Florence wrote:
 That fixed the example I gave, but now this fails:
 
 (let ()
   (def)
   (let ()
 (use)))
 
 On Mon, Jul 20, 2015 at 2:50 PM Matthew Flatt mfl...@cs.utah.edu wrote:
 
  Repair pushed.
 
 
 
   On Jul 20, 2015, at 11:14 AM, Matthew Flatt mfl...@cs.utah.edu wrote:
  
   Thanks for the info. I think it's a bug in the expander, and I have a
   repair, but I think that repair might point to another bug that I'm
   still investigating.
  
   At Mon, 20 Jul 2015 12:56:49 -0400, Alexander D. Knauth wrote:
   I don't really know what's going on, but this might help:
  
   ;; It seems to be introducing the definition correctly, but not the use:
   ;; this works
   (let ()
(def) ; no difference between (def) and (define id 5)
id)
  
   ;; this doesn't
   (let ()
(def)
(use)) ; but there is a difference between (use) and id
  
   ;; and this doesn't either
   (let ()
(define id 5)
(use))
  
   On Jul 20, 2015, at 12:35 PM, Spencer Florence spen...@florence.io
  wrote:
  
   Hello,
  
   I'm trying to update some code to the new expander. The below code
  works on
   6.2 but fails on the new expander with an unbound identifier error.
  
   #lang racket
   (require (for-syntax syntax/parse))
  
   ;; a standard context for identifiers
   (define-for-syntax ctx #'ctx)
  
   ;; create an ID with the context `ctx`, and the current
   ;; expander mark (so that the mark is canceled later),
   ;; and the location loc
   (define-for-syntax (make-id loc)
(syntax-local-introduce
 (datum-syntax ctx 'id loc)))
  
   ;; This introduces a binding
   (define-syntax (def stx)
(syntax-parse stx
  [(def)
   (with-syntax ([id (make-id #'here)])
 #'(define id 5))]))
  
   ;; this attempts to use the binding introduced by `def`
   (define-syntax (use stx)
(syntax-parse stx
  [(use)
   (with-syntax ([id (make-id #'here)])
 #'id)]))
  
   ;; this works
   #;
   (begin
(def)
(use))
  
   ;; this fails
   (let ()
(def)
(use))
  
   --
   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.
 
 
 -- 
 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] Macro introduce identifiers in the new expander

2015-07-20 Thread Alexander D. Knauth
I don't really know what's going on, but this might help:

;; It seems to be introducing the definition correctly, but not the use:
;; this works
(let ()
  (def) ; no difference between (def) and (define id 5)
  id)

;; this doesn't
(let ()
  (def)
  (use)) ; but there is a difference between (use) and id

;; and this doesn't either
(let ()
  (define id 5)
  (use))

On Jul 20, 2015, at 12:35 PM, Spencer Florence spen...@florence.io wrote:

 Hello,
 
 I'm trying to update some code to the new expander. The below code works on 
 6.2 but fails on the new expander with an unbound identifier error. 
 
 #lang racket
 (require (for-syntax syntax/parse))
 
 ;; a standard context for identifiers
 (define-for-syntax ctx #'ctx)
 
 ;; create an ID with the context `ctx`, and the current
 ;; expander mark (so that the mark is canceled later),
 ;; and the location loc
 (define-for-syntax (make-id loc)
   (syntax-local-introduce
(datum-syntax ctx 'id loc)))
 
 ;; This introduces a binding
 (define-syntax (def stx)
   (syntax-parse stx
 [(def)
  (with-syntax ([id (make-id #'here)])
#'(define id 5))]))
 
 ;; this attempts to use the binding introduced by `def`
 (define-syntax (use stx)
   (syntax-parse stx
 [(use)
  (with-syntax ([id (make-id #'here)])
#'id)]))
 
 ;; this works
 #;
 (begin
   (def)
   (use))
 
 ;; this fails
 (let ()
   (def)
   (use))
 
 -- 
 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.


[racket-users] Macro introduce identifiers in the new expander

2015-07-20 Thread Spencer Florence
Hello,

I'm trying to update some code to the new expander. The below code works on
6.2 but fails on the new expander with an unbound identifier error.

#lang racket
(require (for-syntax syntax/parse))

;; a standard context for identifiers
(define-for-syntax ctx #'ctx)

;; create an ID with the context `ctx`, and the current
;; expander mark (so that the mark is canceled later),
;; and the location loc
(define-for-syntax (make-id loc)
  (syntax-local-introduce
   (datum-syntax ctx 'id loc)))

;; This introduces a binding
(define-syntax (def stx)
  (syntax-parse stx
[(def)
 (with-syntax ([id (make-id #'here)])
   #'(define id 5))]))

;; this attempts to use the binding introduced by `def`
(define-syntax (use stx)
  (syntax-parse stx
[(use)
 (with-syntax ([id (make-id #'here)])
   #'id)]))

;; this works
#;
(begin
  (def)
  (use))

;; this fails
(let ()
  (def)
  (use))

-- 
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] Macro introduce identifiers in the new expander

2015-07-20 Thread Matthew Flatt
Repair pushed.



 On Jul 20, 2015, at 11:14 AM, Matthew Flatt mfl...@cs.utah.edu wrote:
 
 Thanks for the info. I think it's a bug in the expander, and I have a
 repair, but I think that repair might point to another bug that I'm
 still investigating.
 
 At Mon, 20 Jul 2015 12:56:49 -0400, Alexander D. Knauth wrote:
 I don't really know what's going on, but this might help:
 
 ;; It seems to be introducing the definition correctly, but not the use:
 ;; this works
 (let ()
  (def) ; no difference between (def) and (define id 5)
  id)
 
 ;; this doesn't
 (let ()
  (def)
  (use)) ; but there is a difference between (use) and id
 
 ;; and this doesn't either
 (let ()
  (define id 5)
  (use))
 
 On Jul 20, 2015, at 12:35 PM, Spencer Florence spen...@florence.io wrote:
 
 Hello,
 
 I'm trying to update some code to the new expander. The below code works on
 6.2 but fails on the new expander with an unbound identifier error. 
 
 #lang racket
 (require (for-syntax syntax/parse))
 
 ;; a standard context for identifiers
 (define-for-syntax ctx #'ctx)
 
 ;; create an ID with the context `ctx`, and the current
 ;; expander mark (so that the mark is canceled later),
 ;; and the location loc
 (define-for-syntax (make-id loc)
  (syntax-local-introduce
   (datum-syntax ctx 'id loc)))
 
 ;; This introduces a binding
 (define-syntax (def stx)
  (syntax-parse stx
[(def)
 (with-syntax ([id (make-id #'here)])
   #'(define id 5))]))
 
 ;; this attempts to use the binding introduced by `def`
 (define-syntax (use stx)
  (syntax-parse stx
[(use)
 (with-syntax ([id (make-id #'here)])
   #'id)]))
 
 ;; this works
 #;
 (begin
  (def)
  (use))
 
 ;; this fails
 (let ()
  (def)
  (use))
 
 -- 
 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] Macro introduce identifiers in the new expander

2015-07-20 Thread Matthew Flatt
Thanks for the info. I think it's a bug in the expander, and I have a
repair, but I think that repair might point to another bug that I'm
still investigating.

At Mon, 20 Jul 2015 12:56:49 -0400, Alexander D. Knauth wrote:
 I don't really know what's going on, but this might help:
 
 ;; It seems to be introducing the definition correctly, but not the use:
 ;; this works
 (let ()
   (def) ; no difference between (def) and (define id 5)
   id)
 
 ;; this doesn't
 (let ()
   (def)
   (use)) ; but there is a difference between (use) and id
 
 ;; and this doesn't either
 (let ()
   (define id 5)
   (use))
 
 On Jul 20, 2015, at 12:35 PM, Spencer Florence spen...@florence.io wrote:
 
  Hello,
  
  I'm trying to update some code to the new expander. The below code works on 
 6.2 but fails on the new expander with an unbound identifier error. 
  
  #lang racket
  (require (for-syntax syntax/parse))
  
  ;; a standard context for identifiers
  (define-for-syntax ctx #'ctx)
  
  ;; create an ID with the context `ctx`, and the current
  ;; expander mark (so that the mark is canceled later),
  ;; and the location loc
  (define-for-syntax (make-id loc)
(syntax-local-introduce
 (datum-syntax ctx 'id loc)))
  
  ;; This introduces a binding
  (define-syntax (def stx)
(syntax-parse stx
  [(def)
   (with-syntax ([id (make-id #'here)])
 #'(define id 5))]))
  
  ;; this attempts to use the binding introduced by `def`
  (define-syntax (use stx)
(syntax-parse stx
  [(use)
   (with-syntax ([id (make-id #'here)])
 #'id)]))
  
  ;; this works
  #;
  (begin
(def)
(use))
  
  ;; this fails
  (let ()
(def)
(use))
  
  -- 
  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.