Konrad, you may wish to work with Stephen whose latest research project is about combining static checking with expansion so that you don’t separate those two steps.
> On Oct 25, 2016, at 6:20 AM, Konrad Hinsen <konrad.hin...@fastmail.net> wrote: > > Thanks to Dmitry, Matthias, and Alexis for their comments, which were > very helpful to understand the principles of error reporting in DSLs. > > My summary is (please correct me if I am wrong!): > > 1) If my DSL code expands to Racket code doing error checking/reporting > at the top level, the syntax transformers take care of attaching the > correct source location in the DSL code to the error message. > > 2) Using expr/c from syntax/parse, I can formulate the error checking > as a contract and make it part of the syntax transformer, which > is indeed a good place to have it. > > The inconvenience with both of these approaches is that the validation > of the DSL code must be separated completely from the code that > processes it. In my case, which implies traversals of complex graphs, > that means writing nearly identical code but separate code for > validation and processing, and doing some potentially expensive > computations twice. It is probably possible to avoid code duplication by > some refactoring, but the execution time penalty remains. > > What I intend to try is to generate an exception-catching wrapper around > my processing code that re-raises the exception from the module's > top-level. I will report on my findings. > > Thanks again, > Konrad -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.