Re: [racket-dev] Enhancement to the syntax system?

2014-05-03 Thread Marijn Schouten (hkBst)
On 07/10/2012 05:03 PM, Matthew Flatt wrote: At Tue, 10 Jul 2012 10:51:57 -0400, Eli Barzilay wrote: 20 minutes ago, Marijn wrote: It seems to me that both these results cannot be correct simultaneously, but I'll await the experts' opinion on that. This does look weird: #lang racket

Re: Enhancement to the syntax system?

2012-07-10 Thread Ludovic Courtès
Hi! Stefan Israelsson Tampe stefan.ita...@gmail.com skribis: | It’s true that it’s annoying that the wrong binding is silently used. | Do you think it’s common enough to justify new syntax? Yes this highlights a comon problem when implementing racket match with #`. Sure, but it’s not

Re: Enhancement to the syntax system?

2012-07-10 Thread Stefan Israelsson Tampe
I did miss something when trying in racket, it's a psyntax bug! Look! racket: (define-for-syntax (f x) #`(let ((x 1)) #,x)) (define-syntax (g x) (syntax-case x ()((_ y) #`(let ((x y)) #,(f #'x ) (g 4) 4 In guile, scheme@(guile-user) (define (f x) #`(let ((x 1)) #,x)) scheme@(guile-user)

Re: Enhancement to the syntax system?

2012-07-10 Thread Marijn
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 10-07-12 15:35, Stefan Israelsson Tampe wrote: I did miss something when trying in racket, it's a psyntax bug! I'm glad you're finally looking harder at the Racket behavior. racket: (define-for-syntax (f x) #`(let ((x 1)) #,x)) (define-syntax

Re: [racket-dev] Enhancement to the syntax system?

2012-07-10 Thread Eli Barzilay
20 minutes ago, Marijn wrote: It seems to me that both these results cannot be correct simultaneously, but I'll await the experts' opinion on that. This does look weird: #lang racket (define-for-syntax (f stx) #`(let ([x 1]) #,stx)) (define-syntax (m stx) (with-syntax ([zz (f

Re: Enhancement to the syntax system?

2012-07-10 Thread Ludovic Courtès
Hi, Stefan Israelsson Tampe stefan.ita...@gmail.com skribis: racket: (define-for-syntax (f x) #`(let ((x 1)) #,x)) (define-syntax (g x) (syntax-case x ()((_ y) #`(let ((x y)) #,(f #'x ) (g 4) 4 In guile, scheme@(guile-user) (define (f x) #`(let ((x 1)) #,x)) scheme@(guile-user)

Re: [racket-dev] Enhancement to the syntax system?

2012-07-10 Thread Ludovic Courtès
Hi, Matthew Flatt mfl...@cs.utah.edu skribis: It's natural --- but not correct --- to think that #` is responsible for hygiene, in which case `(f #'x)' should keep the given `x' separate from the `let'-bound `x' in the result. [...] If you change the example to #lang racket

Re: [racket-dev] Enhancement to the syntax system?

2012-07-10 Thread Stefan Israelsson Tampe
samth made a pointer to http://srfi.schemers.org/srfi-72/srfi-72.html It does not look like guile racket etc. have implemented this yet. Am I wrong? This is precisely what I'm after! On Tue, Jul 10, 2012 at 5:26 PM, Ludovic Courtès l...@gnu.org wrote: Hi, Matthew Flatt mfl...@cs.utah.edu

Re: [racket-dev] Enhancement to the syntax system?

2012-07-10 Thread Matthew Flatt
At Tue, 10 Jul 2012 10:51:57 -0400, Eli Barzilay wrote: 20 minutes ago, Marijn wrote: It seems to me that both these results cannot be correct simultaneously, but I'll await the experts' opinion on that. This does look weird: #lang racket (define-for-syntax (f stx) #`(let ([x

Re: [racket-dev] Enhancement to the syntax system?

2012-07-10 Thread Ryan Culpepper
On 07/10/2012 10:51 AM, Eli Barzilay wrote: 20 minutes ago, Marijn wrote: It seems to me that both these results cannot be correct simultaneously, but I'll await the experts' opinion on that. This does look weird: #lang racket (define-for-syntax (f stx) #`(let ([x 1]) #,stx))

Re: [racket-dev] Enhancement to the syntax system?

2012-07-10 Thread Eli Barzilay
An hour and a half ago, Matthew Flatt wrote: It's natural --- but not correct --- to think that #` is responsible for hygiene, in which case `(f #'x)' should keep the given `x' separate from the `let'-bound `x' in the result. Instead, hygiene is the responsibility of macro invocation, and

Re: Enhancement to the syntax system?

2012-07-04 Thread Marijn
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Stefan, On 03-07-12 23:52, Stefan Israelsson Tampe wrote: You do not need gensyms if you try to mimic or implement my suggested #. . On the other hand when if you do this (define (f stx) #`(let ((x 1)) #,stx)) and use this with #`(let

Re: Enhancement to the syntax system?

2012-07-04 Thread Stefan Israelsson Tampe
Funny, for guile I get, scheme@(guile-user) (define (f x) #`(let ((x 1)) #,x)) scheme@(guile-user) (define-syntax m (lambda (x) (syntax-case x () ((_) #`(let ((x 2)) #,(f #'x)) scheme@(guile-user) (m) $1 = 1 I ported the racket matcher to guile and worked in that environment, so this

Re: Enhancement to the syntax system?

2012-07-03 Thread Ludovic Courtès
Hey! Stefan Israelsson Tampe stefan.ita...@gmail.com skribis: Stefan Israelsson Tampe stefan.ita...@gmail.com skribis: Maybe this help to see what I'm after, #'(let ((x v)) #.(f #'x)) = (let-syntax ((g (lambda (stx) (syntax-case stx ((_ x) (f #'x) #'(let ((x v)) (g x))

Re: Enhancement to the syntax system?

2012-07-03 Thread Stefan Israelsson Tampe
You do not need gensyms if you try to mimic or implement my suggested #. . On the other hand when if you do this (define (f stx) #`(let ((x 1)) #,stx)) and use this with #`(let ((x 2)) #,(f #'x)) the resulting expanded code would produce 1 which is not what you want. So in the racket matcher I

Re: Enhancement to the syntax system?

2012-07-02 Thread Ludovic Courtès
Hi Stefan, Stefan Israelsson Tampe stefan.ita...@gmail.com skribis: Hygiene is harder to maintain. e.g. I kept on hitting this kind of code snippets #'(let ((x v)) #,(f rest #'x)) The problem with this code is hygiene, I need to make a gensym and use with-syntax to bound x to that

Re: Enhancement to the syntax system?

2012-07-02 Thread Stefan Israelsson Tampe
Maybe this help to see what I'm after, #'(let ((x v)) #.(f #'x)) = (let-syntax ((g (lambda (stx) (syntax-case stx ((_ x) (f #'x) #'(let ((x v)) (g x)) Now I would like to have a corresponding #.@ notation as well but can't find an analog for that :-( /Stefan On Mon, Jul 2, 2012 at

Re: Enhancement to the syntax system?

2012-07-02 Thread Ludovic Courtès
Hey! Stefan Israelsson Tampe stefan.ita...@gmail.com skribis: Maybe this help to see what I'm after, #'(let ((x v)) #.(f #'x)) = (let-syntax ((g (lambda (stx) (syntax-case stx ((_ x) (f #'x) #'(let ((x v)) (g x)) Sorry, I fail to understand the problem you’re trying to solve.