I got these scheme:
- hin.lsp
Code: Select all
(context 'hin) (define (hin-show) (println "from hin.lsp"))
- wrappers.lsp
Code: Select all
(load "hin.lsp") (define (wrap-one) (context hin) (hin-show) ; this wont work (context MAIN))
- main.lsp
Code: Select all
(load "wrappers.lsp") (wrap-one)
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 all
(html lang= "en"
(head
(title "Some title"))
(body
(p class= "shiny" "Lore ipsum...")))
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 all
(define (wrap-one)
(wrap-in-context
(...))) ; calls to hin functions