I got these scheme:
Code Select
(context 'hin)
(define (hin-show)
(println "from hin.lsp"))
Code Select
(load "hin.lsp")
(define (wrap-one)
(context hin)
(hin-show) ; this wont work
(context MAIN))
Code Select
(load "wrappers.lsp")
(wrap-one)
File hin.lsp contains 244 symbols (functions and constants) autogenerated. It's a DSL for HTML5.
File wrappers.lsp contains functions to wrap snippets of reusable code like: header, navbar, sidebar, you-get-the-idea.
File main.lsp calls functions from wrappers.lsp.
Now, the context switch shown in function wrap-one wont produce the desired result. I think it's because the double pass newlisp parser does. So on the first pass (hin-show) gets transformed into (MAIN:hin-show).
The idea of hin.lsp is to be able to wrote code like this:
Code Select
(html lang= "en"
(head
(title "Some title"))
(body
(p class= "shiny" "Lore ipsum...")))
If I have to prefix every call with "hin:" or even with an alias like "h:" hin's while purpose is defeated, which is to be as close to HTML syntax as possible.
My question is: what's the best way to wrap functions calls from hin inside a function defined in another context without prefixing hin calls?
I'm trying to build a macro to parse those calls by my own and prefix when appropriate, it will be used like this:
Code Select
(define (wrap-one)
(wrap-in-context
(...))) ; calls to hin functions
But I'm having problems recurring inside the macro. And now I'm thinking all this extra parsing could make the whole idea to work too slow. Anyway, I'm digressing. Back to the point: any ideas about how to avoid prepending all calls with context name?