question on parencsript minification

Eric Schulte schulte.eric at gmail.com
Tue Aug 20 19:12:54 UTC 2013


First off, my thanks to the parenscript developers.  This is a very
useful tool.  To learn parenscript, I've thrown together the following
little HTML5 web-page genetic programming image matching application.

  http://eschulte.github.io/gpolygon/

Everything works well, until I try to minimize or obfuscate the
generated JavaScript.  I think I must be misunderstanding how
minimization works.  I'm able to minimize this package using the
following adopted from the reference manual.

    (defpackage :gpolygon
      (:use :common-lisp :hunchentoot :cl-who :parenscript :cl-fad)
      (:export :serve))
    (in-package :gpolygon)
    (eval-when (:compile-toplevel :load-toplevel :execute)
      (setf *js-string-delimiter* #\")
      (setf *ps-print-pretty* nil)
      (obfuscate-package :gpolygon
        (let ((code-pt-counter #x8CF6)
              (symbol-map (make-hash-table)))
          (lambda (symbol)
            (or (gethash symbol symbol-map)
                (setf (gethash symbol symbol-map)
                      (make-symbol
                       (string (code-char (incf code-pt-counter))))))))))

However, many proper function names are changed which should not be
(e.g., length, etc...).  I've tried to include the ps-dhtml-symbols
package to prevent this, but of course this package causes *many*
conflicts with common lisp functions throwing errors like [1].  I'm
clearly doing something wrong, and must be including the symbol-name
package incorrectly?  Any pointers would be greatly appreciated?

Thanks,

Footnotes: 
[1]  USE-PACKAGE #<PACKAGE "PS-DHTML-SYMBOLS"> causes name-conflicts
     in #<PACKAGE "GPOLYGON"> between the following symbols:
       #:LENGTH, COMMON-LISP:LENGTH

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D



More information about the parenscript-devel mailing list