Hello,
I'm using parenscript from current quicklisp.
In the tutorial I see that parenscript should be :USEd.
My package already uses :ITERATE and :ALEXANDRIA - and that gives me conflicts for (at least) alexandria:switch and iterate:for.
Is there a preferred way to handle this? Should I _not_ use parenscript, but use the PS: prefix? And for what symbols? PS:DEFUN to get a javascript function defined?
Or would it be better to make parenscript :USE alexandria and iterate - AFAICS the symbols are unbound anyway (the few that I've looked at), so there should be no problem importing them?
Any help is appreciated.
Thank you!
Regards,
Phil
Hi,
Is there a preferred way to handle this? Should I _not_ use parenscript, but use the PS: prefix? And for what symbols? PS:DEFUN to get a javascript function defined?
One way to do it is to use the :shadowing-import-from option to DEFPACKAGE to resolve the conflicts by picking which symbols you want to import into your package (http://cliki.net/site/HyperSpec/Body/mac_defpackage.html). Since ps:for is different than alexandria:for, if you (:shadowing-import-from :alexandria #:for), then you'd need to write (ps:for ...for loop...) if you want to write a for loop in Parenscript code.
Or would it be better to make parenscript :USE alexandria and iterate - AFAICS the symbols are unbound anyway (the few that I've looked at), so there should be no problem importing them?
The symbols aren't bound to Common Lisp functions or macros, but they have meaning as special forms or macros for the Parenscript compiler.
Vladimir
Hello Vladimir,
thank you very much for your quick answer.
One way to do it is to use the :shadowing-import-from option
...
(:shadowing-import-from :alexandria #:for), then you'd need to write (ps:for ...for loop...) if you want to write a for loop in Parenscript code.
Which is clearly suboptimal, IMO.
Or would it be better to make parenscript :USE alexandria and iterate - AFAICS the symbols are unbound anyway (the few that I've looked at), so there should be no problem importing them?
The symbols aren't bound to Common Lisp functions or macros, but they have meaning as special forms or macros for the Parenscript compiler.
Well, AFAIU the symbols _identity_ (as seen by EQ) is important; so, if parenscript would import the symbols from alexandria and iterate, there should be no change in behaviour, right?
The disadvantage to that solution is that there's a load order dependency; and simply requiring alexandria, iterate, and other libraries for parenscript is bad, too, because they might not actually be needed.
Another way I see would be to use the symbol name (like eg. LOOP does) - don't use the package, but eg. do (EQUAL (SYMBOL-NAME sym) "FOR").
For user-defined functions and so on there's clearly a need to support multiple packages; but for the keywords that might work.
Opinions?
Regards,
Phil
parenscript-devel@common-lisp.net