Re: [racket-dev] Identifier macros

2012-12-05 Thread Tobias Hammer
I learned about identifier macros mostly from scrambling through the racket sources. There they are often seen in places where macros are used instead of functions to avoid the cost of a function call. Normally. macros have the drawback that they can't be passed around or applied like

Re: [racket-dev] Identifier macros

2012-12-05 Thread Matthew Flatt
I'd like to improve the documentation, but I can't tell which part you're talking about. (The only place where I can find identifier macros is in the Guide, but that's about `syntax-rules' versus `syntax-id-rules'.) Can you point to the part that you're reading and the specific text that seems

Re: [racket-dev] Identifier macros

2012-12-05 Thread Matthias Felleisen
I think two additions/refinements would be good here: 1. The section on identifier macros in the Guide (16.1.5) should mention that define-syntax introduces short-hands for identifiers, period. That is, the following interaction works perfectly fine: (define-syntax (foo stx) #'7) (+ foo

Re: [racket-dev] Identifier macros

2012-12-05 Thread Matthew Flatt
At Wed, 5 Dec 2012 09:41:37 -0500, Matthias Felleisen wrote: I think two additions/refinements would be good here: 1. The section on identifier macros in the Guide (16.1.5) should mention that define-syntax introduces short-hands for identifiers, period. I think a `define-syntax' that

Re: [racket-dev] Identifier macros

2012-12-05 Thread Carl Eastlund
On looking back, my confusion was not entirely due to the documentation, but partly from my own expectations coming in to it. If I just look up identifier macro, trying to figure out how to write one, I get a link to section 16.1.5. This does not directly state the context involving

Re: [racket-dev] Identifier macros

2012-12-05 Thread Matthew Flatt
At Wed, 5 Dec 2012 14:25:29 -0500, Carl Eastlund wrote: On looking back, my confusion was not entirely due to the documentation, but partly from my own expectations coming in to it. If I just look up identifier macro, trying to figure out how to write one, I get a link to section 16.1.5.

Re: [racket-dev] Identifier macros

2012-12-05 Thread Jon Rafkind
Actually I would hope that section 1.2 (syntax model) in the reference would explain exactly how macros are invoked. Unless I'm missing something it never mentions exactly what syntax object is passed to the transformer function once a macro binding is observed. It could either go in paragraph

Re: [racket-dev] Identifier macros

2012-12-04 Thread Eli Barzilay
8 hours ago, Carl Eastlund wrote: I'm confused about so-called identifier macros.  I had thought that ordinary transformers bound to functions could only transform application-position references to themselves, and that a set! transformer was required to transform bare references and set!