Re: [racket] Lazy syntax class attributes

2013-06-09 Thread Ryan Culpepper
I think it's actually due to the implementation of the 'syntax' form: it collects pattern variables in a hash table. I don't think you should expect promises to be forced in a particular order. If you absolutely need them to, you should probably force them yourself. For example, instead of #

Re: [racket] Lazy syntax class attributes

2013-06-09 Thread Eric Dobson
Confirmed that it is internal to syntax parse. #lang racket (begin-for-syntax (require syntax/parse racket/promise) (define-syntax-class foo (pattern x:id #:attr y (delay (displayln (syntax->datum #'x)) #''x (define-syntax bar (syntax-parser ((_ a:foo b:foo c:foo d:foo e

Re: [racket] Lazy syntax class attributes

2013-06-09 Thread Eric Dobson
I'm seeing something which looks like on different runs of my program different attributes are forced in different orders. The change that triggers this is changing something unrelated in the syntax pattern. I'm still working at understanding what is triggering this so that I can reproduce a small

Re: [racket] Lazy syntax class attributes

2013-06-05 Thread Eric Dobson
I started working with this last night, and it simplified the code a lot. I was able to build syntax classes on top of other ones with a lot less worrying about when the slow path would be run. (And uncovered a couple of optimizer bugs in the process). On Wed, Jun 5, 2013 at 2:05 PM, Ryan Culpepp

Re: [racket] Lazy syntax class attributes

2013-06-05 Thread Ryan Culpepper
I've implemented what I described earlier, as well as the error on 3D values in a #:with clause or ~parse right-hand side. Pattern variables that come from syntax-parse already acted differently; if they weren't syntax-valued, they raised errors. All I've done now is turn some error cases into

Re: [racket] Lazy syntax class attributes

2013-06-01 Thread Eric Dobson
I would say not to implement this just on my behalf. I think it would be weird for pattern variables to act differently if they came from syntax-parse versus from with-syntax. On Fri, May 31, 2013 at 2:17 PM, Sam Tobin-Hochstadt wrote: > On Fri, May 31, 2013 at 4:42 PM, Ryan Culpepper wrote: >>

Re: [racket] Lazy syntax class attributes

2013-05-31 Thread Sam Tobin-Hochstadt
On Fri, May 31, 2013 at 4:42 PM, Ryan Culpepper wrote: > > Note, however, that the syntax class now uses #:attr instead of #:with. > That's the main usability issue I'm worried about with this change. > Following with-syntax's lead, a #:with clause automatically converts its > right-hand side to s

Re: [racket] Lazy syntax class attributes

2013-05-31 Thread Ryan Culpepper
On 05/31/2013 02:47 AM, Eric Dobson wrote: I'm working on code (TR optimizer) that needs to match some expressions and then compute an attribute based on the expression. I would like to abstract this out as a syntax class. Example is below: #lang racket (require syntax/parse) (define-syntax-cla

Re: [racket] Lazy syntax class attributes

2013-05-31 Thread Matthias Felleisen
You would have to implement laziness for attributes manually -- I think. But I don't have time to play with code and get an example to work right now. -- Matthias On May 31, 2013, at 11:00 AM, Eric Dobson wrote: > That seems like a a workable amount of overhead, but I'm not sure what > you ar

Re: [racket] Lazy syntax class attributes

2013-05-31 Thread Eric Dobson
-lang.org > Sent: Friday, May 31, 2013 11:00:13 AM GMT -05:00 US/Canada Eastern > Subject: Re: [racket] Lazy syntax class attributes > > That seems like a a workable amount of overhead, but I'm not sure what > you are suggesting the v attribute to be bound as. It might have

Re: [racket] Lazy syntax class attributes

2013-05-31 Thread J. Ian Johnson
rhs ... Too much? -Ian - Original Message - From: "Eric Dobson" To: "Matthias Felleisen" Cc: users@racket-lang.org Sent: Friday, May 31, 2013 11:00:13 AM GMT -05:00 US/Canada Eastern Subject: Re: [racket] Lazy syntax class attributes That seems like a a workable amou

Re: [racket] Lazy syntax class attributes

2013-05-31 Thread Eric Dobson
That seems like a a workable amount of overhead, but I'm not sure what you are suggesting the v attribute to be bound as. It might have not been obvious from my my example that its value depends on the slow computation, so unless pattern variables can be mutated I'm not sure how force-all can chang

Re: [racket] Lazy syntax class attributes

2013-05-31 Thread Matthias Felleisen
Can you prefix the #'(complicated ..) expression with a form that forces all lazy computations so that complicated itself remains the same? (let () (force-all) #'(complicated (form e.v))) where force-all is defined via a begin in the slow syntax class? -- Matthias On May 31, 2013, at 2:4

[racket] Lazy syntax class attributes

2013-05-30 Thread Eric Dobson
I'm working on code (TR optimizer) that needs to match some expressions and then compute an attribute based on the expression. I would like to abstract this out as a syntax class. Example is below: #lang racket (require syntax/parse) (define-syntax-class slow (pattern e:expr #:with v