Re: Access to optimization qualities



zellerin@xxxxxxxxx wrote:
Hello,

is it somehow possible to get at current settings of optimization
qualities, probably at macro-expansion time? The aim is to expand to
different code under different circumstances. Issue writeup
http://www.lisp.org/HyperSpec/Issues/iss101-writeup.html seems to
suggest that it could be *somehow* possible, but I do not see any
portable (or even non-portable, for clisp) way how to do it. I pondered
if it could be part of the environment, but that is implementation
dependent anyway.

It is implementation dependent. There was an attempt in CLtL2 to define access operations for environment objects, but that didn't make it into the ANSI Common Lisp standard. It was only recently that Allegro Common Lisp has provided a (seemingly) complete solution for doing this.


Either your implementation supports some elements of the CLtL2 approach, or you should find ways to implement Allegro's approach.

I have implemented a workaround for ContextL in which I also wanted a macro to expand differently according to optimization settings. The basic idea is to introduce a symbol macro that describes your own optimization setting, for example like this:

(define-symbol-macro optimize-xyz nil)

This allows a user to specify that he/she wants a different setting for a particular region of code:

(symbol-macrolet ((optimize-xyz t))
  ...)

Inside a macro you can access that information as follows:

(defmacro bla (... &environment env)
  (let ((optimize-xyz (macroexpand 'optimize-xyz env)))
    (if optimize-xyz
       (do-this ...)
       (do-that ...))))

You can make this look nicer by providing your own macro for the user that expands into symbol-macrolet.


Pascal

--
My website: http://p-cos.net
Closer to MOP & ContextL:
http://common-lisp.net/project/closer/
.



Relevant Pages

  • Re: Cant use EFS: "This machine is disabled for encryption."
    ... In the Group Policy Object Editor, expand Computer Configuration, ... > expand Windows Settings, expand Security Settings, expand Public Key ... Right-click Encrypting File System, and then click Properties. ...
    (microsoft.public.windowsxp.general)
  • Re: Auditing Log OFF
    ... go to run and type in gpedit.msc under "Computer Configuration" expand ... "Windows Settings" then expand "Security Settings" then expand "Local ... Make the auditing is enabled in there. ...
    (microsoft.public.win2000.security)
  • Re: AutoEnrollment Errors (Event ID 15)
    ... The problem often occur when client contact WinNT DNS server. ... In the left pane, expand "Computer Configuration", expand "Windows ... Settings", expand "Security Settings", and then expand "Public Key ...
    (microsoft.public.windows.server.migration)
  • Re: Performance problem with _SECURE_SCL=0
    ... In the settings of the project, in the C++ section, I set the optimization ... favor size or speed = favor fast code ... Ouch, yes, those settings make a phenomenal difference and do result ...
    (microsoft.public.vc.stl)
  • Re: Is there a way to change the name for the default Admin
    ... Use the local group policy editor: Expand Computer Configuration, expand Windows Settings, expand Security Settings, expand Local Policies, and then click Security Options. ... You can also create a group policy object in Active Directory and deploy it to your XPe devices as long they’re part of a domain. ... I don’t suppose that there is any way for me to change the username for the Administrator Account, ...
    (microsoft.public.windowsxp.embedded)