Edi Weitz [edi@agharta.de] wrote:
On Tue, 8 Mar 2005 10:52:47 -0600, Kick Damien-DKICK1 DKICK1@motorola.com wrote:
Personally, I still would like to know of an easy way to change these settings.
Me too. If there's a simple idiom for this I'll be happy to incorporate it into CL-PPCRE.
Silly Damien, RTFM. There was a X3J13 issue http://tinyurl.com/6mw2d in which the ability to write macros that expanded into declaration forms was removed. The discussion of the issue includes examples of how to acheive the wanted affect. For the moment, the following is my favorite:
Another tactic would be:
Old code: (EVAL-WHEN (EVAL COMPILE LOAD) (DEFVAR *SPEEDY* NIL)) (DEFMACRO USE-STANDARD-SPEED-AND-SAFETY () (IF *SPEEDY* `(DECLARE (OPTIMIZE (SPEED 3) (SAFETY 0))) `(DECLARE (OPTIMIZE (SPEED 0) (SAFETY 3))))) (DEFUN FOO () (USE-STANDARD-SPEED-AND-SAFETY) ...) New code: (EVAL-WHEN (EVAL COMPILE LOAD) (DEFVAR *STANDARD-SPEED-AND-SAFETY* '((SPEED 0) (SAFETY 3)))) (DEFUN FOO () (DECLARE (OPTIMIZE #.*STANDARD-SPEED-AND-SAFETY*)) ...)
-- Damien Kick
On Tue, 8 Mar 2005 13:17:41 -0600, Kick Damien-DKICK1 DKICK1@motorola.com wrote:
New code: (EVAL-WHEN (EVAL COMPILE LOAD) (DEFVAR *STANDARD-SPEED-AND-SAFETY* '((SPEED 0) (SAFETY 3)))) (DEFUN FOO () (DECLARE (OPTIMIZE #.*STANDARD-SPEED-AND-SAFETY*)) ...)
Looks cool to me. How about a patch for CL-PPCRE?
:)
Cheers, Edi.
I suggest taking a page from GBBopen's book and using something like:
(defmacro with-standard-optimization (&body body) `(locally (declare (optimize (speed 1) (safety 3) (debug 1))) ,@body))
(defun foo () (with-standard-optimization ...))
this has the advantage of not requiring the read time evaluation of #. which some view as a security risk.
On Mar 8, 2005, at 2:30 PM, Edi Weitz wrote:
New code: (EVAL-WHEN (EVAL COMPILE LOAD) (DEFVAR *STANDARD-SPEED-AND-SAFETY* '((SPEED 0) (SAFETY 3)))) (DEFUN FOO () (DECLARE (OPTIMIZE #.*STANDARD-SPEED-AND-SAFETY*)) ...)
On Tue, 8 Mar 2005 14:43:36 -0500, Gary King gwking@metabang.com wrote:
I suggest taking a page from GBBopen's book and using something like:
(defmacro with-standard-optimization (&body body) `(locally (declare (optimize (speed 1) (safety 3) (debug 1))) ,@body))
(defun foo () (with-standard-optimization ...))
this has the advantage of not requiring the read time evaluation of #. which some view as a security risk.
I have to admit that I find the #. approach more aesthetically pleasing - one reason is that it doesn't introduce a new level of nesting.
I fail to see the security risk - we're not talking about data entered from a random website or somesuch.
Cheers, Edi.
cl-ppcre-devel@common-lisp.net