A lot of macros start by renaming some syntax that's assumed to
eventually represent a runtime value, like the `or' macro does:
(syntax-datum (expand-syntax #'(or #t #f)))
'(let-values (((or-part) '#t)) (if or-part or-part '#f))
But it's not always a good thing, particularly when the output
This is definitely a macro writer bill of rights situation. Too bad
that TR's optimizer cannot take advantage of all these kinds of things
that are already happening in the optimizer one level down.
Robby
On Sat, Aug 25, 2012 at 11:19 AM, Neil Toronto neil.toro...@gmail.com wrote:
A lot of
On 08/25/2012 12:19 PM, Neil Toronto wrote:
A lot of macros start by renaming some syntax that's assumed to
eventually represent a runtime value, like the `or' macro does:
(syntax-datum (expand-syntax #'(or #t #f)))
'(let-values (((or-part) '#t)) (if or-part or-part '#f))
But it's not always
Then I suppose the obvious thing to do is move the optimizations up to
the macro level? :)
It's also for debugging, by the way. Having to mentally or manually
substitute bindings to understand fully expanded code annoys me and
wastes time.
Neil ⊥
On 08/25/2012 10:24 AM, Robby Findler
On 08/25/2012 01:08 PM, Neil Toronto wrote:
On 08/25/2012 10:53 AM, Ryan Culpepper wrote:
On 08/25/2012 12:19 PM, Neil Toronto wrote:
I've reordered these a bit:
number
string
bytes
character
regexp
In other words, literal data. But did you check that the '#%datum'
macro associated with
On 08/25/2012 11:33 AM, Ryan Culpepper wrote:
On 08/25/2012 01:08 PM, Neil Toronto wrote:
A number can expand to an arbitrary expression? How?
And what do you mean by the '#%datum' macro associated with them?
Applied to them?
(let-syntax ([#%datum (lambda (stx) #'(printf hello\n))]) 5)
7 hours ago, Matthias Felleisen wrote:
It's the wrong way to go. Let's investigate more before we jump to
conclusions.
Would it work if let-bound (etc) ids could have some property tracing
them to the expressions they were bound to?
--
((lambda (x) (x x)) (lambda (x) (x x)))
On Aug 25, 2012, at 3:56 PM, Ryan Culpepper wrote:
In other words, a macro's subexpressions should be used linearly (as in
linear types). Putting an expression in the macro's result in an expression
context counts as a use. (But putting it in the result in a quoted context
doesn't.)
Investigated a bit today. I wrote a function that optimizes kernel
syntax, making these kinds of replacements:
(let-values ([(x:id) y:id]) body)
-
(let-syntaxes+values ([(x) (make-rename-transformer #'y)]) () body)
and then fully expanding the code again. It also does simple beta
9 matches
Mail list logo