<div>What is the best approach for creating a macro that parses sub-forms in any order, similar to the way (class ...) works in Racket?</div><div><br></div><div>I'm writing a simple sql-like dsl, and originally I had syntax that used keyword-params, as in:</div>
<div><br></div><div>(query client-table #:select "first-name" #:where "type = 3")</div><div><br></div><div>but I'm wondering how to go about achieving something more like:</div><div><br></div><div>
(query client-table<div> (select "first-name, address.city-id")</div><div> (where "client-type = 3"))</div></div><div><br></div><div>The order of the sub-forms shouldn't matter.</div><div><br></div>
<div>I've seen this style everywhere, from emacs-lisp to racket classes, and just wondering if my thinking is correct.</div><div><br></div><div>Should I just loop through the body syntax forms and pass to (match...) in order to process them? Or is this type of nested form style something for which there is a higher level abstraction already built into the macro system?</div>
<div><br></div><div>For example, (select ...) should be it's own macro capable of being composed not just within (query...) but in other contexts as well. But I'd want to limit such contexts so that one can't call (select...) outside one of these pre-allowed parent forms. All of this implies a lot of boiler plate and so I figured maybe I'm creating too much work for myself by attempting to do it all manually.</div>
<div><br></div><div>Thanks a lot.</div><div><div><br></div>-- <br>Talk to you soon,<br><br>Scott Klarenbach<br><br>PointyHat Software Corp.<br><a href="http://www.pointyhat.ca" target="_blank">www.pointyhat.ca</a><br>p 604-568-4280<br>
e <a href="mailto:scott@pointyhat.ca" target="_blank">scott@pointyhat.ca</a><br><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">200-1575 W. Georgia</span><br>
Vancouver, BC <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">V6G2V3</span><br><br>_______________________________________<br>To iterate is human; to recur, divine
</div>