[racket-dev] syntax/syntax proposal

2012-06-15 Thread Asumu Takikawa
Hi all, Recently I was using the `stx-car` function from `syntax/stx`. At some point, I had called it on a non-syntax pair and the error message came from `car`, which is used inside the implementation of `stx-car`. I thought it would be nice to add contracts in `syntax/stx` for better error mess

Re: [racket-dev] syntax/syntax proposal

2012-06-15 Thread Vincent St-Amour
At Fri, 15 Jun 2012 15:12:05 -0400, Asumu Takikawa wrote: > * for consistency with the rest of the language, `stx-car` and > friends would be renamed to use the `syntax-` prefix instead of > `stx-`. +1 I always get these names wrong. > * the name of the library is also consistent w

Re: [racket-dev] syntax/syntax proposal

2012-06-15 Thread Asumu Takikawa
On 2012-06-15 15:12:05 -0400, Asumu Takikawa wrote: > I've attached a patch that implements this. Any comments? Just realized after I sent it that I'd change two things in the patch: * `syntax-null?`, `syntax-pair?`, `syntax-list?` would be defined using `procedure-rename` to get better cont

Re: [racket-dev] syntax/syntax proposal

2012-06-15 Thread Matthias Felleisen
Can we get syntax-first and syntax-rest while you're at it? (I looked for these just a couple of days ago, and like Vincent, I got the stx- wrong) _ Racket Developers list: http://lists.racket-lang.org/dev

Re: [racket-dev] syntax/syntax proposal

2012-06-15 Thread Ryan Culpepper
On 06/15/2012 01:12 PM, Asumu Takikawa wrote: Hi all, Recently I was using the `stx-car` function from `syntax/stx`. At some point, I had called it on a non-syntax pair and the error message came from `car`, which is used inside the implementation of `stx-car`. I thought it would be nice to add

Re: [racket-dev] syntax/syntax proposal

2012-06-15 Thread Vincent St-Amour
At Fri, 15 Jun 2012 15:09:15 -0600, Ryan Culpepper wrote: > The 'stx-*' functions work on values that aren't syntax objects, so > renaming them to 'syntax-*' would be misleading. Given the name, I would have thought they only worked on syntax objects. > Roughly, > >stx = syntax | null | (co

Re: [racket-dev] syntax/syntax proposal

2012-06-15 Thread Matthias Felleisen
On Jun 15, 2012, at 5:25 PM, Vincent St-Amour wrote: >> >> Roughly, >> >> stx = syntax | null | (cons syntax stx) > > I had no idea that was the case. The name certainly does not suggest > that. The fact that the metavariable for syntax objects is `stx' also > does not help. > > In which ca

Re: [racket-dev] syntax/syntax proposal

2012-06-15 Thread Ryan Culpepper
On 06/15/2012 03:25 PM, Vincent St-Amour wrote: At Fri, 15 Jun 2012 15:09:15 -0600, Ryan Culpepper wrote: The 'stx-*' functions work on values that aren't syntax objects, so renaming them to 'syntax-*' would be misleading. Given the name, I would have thought they only worked on syntax objects

Re: [racket-dev] syntax/syntax proposal

2012-06-15 Thread Asumu Takikawa
On 2012-06-15 15:09:15 -0600, Ryan Culpepper wrote: > The 'stx-*' functions work on values that aren't syntax objects, so > renaming them to 'syntax-*' would be misleading. Is that really so misleading though? There is already precedent for functions which take arguments not exactly matching their

Re: [racket-dev] syntax/syntax proposal

2012-06-15 Thread Asumu Takikawa
On 2012-06-15 17:39:27 -0400, Matthias Felleisen wrote: > Sounds like this should be documented and possibly even contracted. The contracts I wrote in the patch do reflect this via the `stx-pair?` predicate, FYI. By the way, the definition of a syntax pair in the documentation is this: A synta