SB-EXT:DESCRIBE-COMPILER-POLICY and local policies

Bug #310287 reported by Tobias C. Rittweiler
2
Affects Status Importance Assigned to Milestone
SBCL
Confirmed
Low
Tobias C. Rittweiler

Bug Description

* The docstring of SB-EXT:DESCRIBE-COMPILER-POLICY should be updated with an example
   of what the SPEC argument can be used for.

* It should additionally take an environment as a second &optional parameter, so you can do

     (defun foo (x)
        (declare (optimize speed))
        (macrolet ((print-policy (&environment env)
                            (sb-ext:describe-compiler-policy nil env)))
           (print-policy))
        ...)

   At the moment you can get that behaviour approximated by using

       (print (sb-cltl2:declaration-information 'optimize env))

Changed in sbcl:
importance: Undecided → Low
status: New → Confirmed
description: updated
Revision history for this message
Tobias C. Rittweiler (tcr) wrote :

How should the lambda-list for DESCRIBE-COMPILER-POLICY should look like?

Can we get rid of the current &OPTIONAL SPEC argument?

Changed in sbcl:
assignee: nobody → tcr
Revision history for this message
Tobias C. Rittweiler (tcr) wrote :

I meanwhile figured out that the purpose of the SPEC argument is probably
to see how the dependent qualities change according to SPEC.

If DESCRIBE-COMPILER-POLICY takes a lexenv, that's not strictly necessary
anymore as

  (describe-compiler-policy '((speed 3) (safety 1)))

would be equivalent to

  (macrolet ((print-policy (&environment e)
                       (describe-compiler-policy-from-lexenv e)
                       nil))
     (declare (optimize (speed 3) (safety 1)))
     (print-policy))

That interface would probably suck, though.

The attached patch simply adds an additional &optional parameter for the lexenv.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.