From: Mark Tarver
Subject: minor stuff with CMU Lisp
Date: 
Message-ID: <1160858348.033209.98330@i42g2000cwa.googlegroups.com>
This is for aficionados of CMU Lisp.

I'm experimenting with CMU Lisp and having some
minor and some not-so-minor problems.  As regards
the minor stuff.

1.  Error messages are printed but with the accompanying
     'Error in function ...." tagged to them; giving the
     function in which the error was raised.   Actually I
     don't want this - is there any way to turn this feature
     off?

2.  Compiler messages.   CMU likes to chat and I'm trying
     to still it.   I have

     *COMPILE-VERBOSE*
     *COMPILE-PRINT*
     *GC-VERBOSE*

    set to NIL.  However I'm still getting some chat, is there a
setting I've missed?

Thanks for your trouble.

Mark

From: Rob Warnock
Subject: Re: minor stuff with CMU Lisp
Date: 
Message-ID: <lMadnX_crq8jBKzYnZ2dnUVZ_oOdnZ2d@speakeasy.net>
Mark Tarver <··········@ukonline.co.uk> wrote:
+---------------
| I'm experimenting with CMU Lisp...
| 1.  Error messages are printed but with the accompanying
|      'Error in function ...." tagged to them; giving the
|      function in which the error was raised.   Actually I
|      don't want this - is there any way to turn this feature off?
+---------------

Why? Don't you want to know where the error occurred?  ;-}

Anyway, if you are not "debugging" per se but just noodling around
in the REPL and don't want to drop into the debugger every time
you typo or violate a function signature, you might like something
like the following [not specific to CMUCL, actually]:

    > (defun my-debugger-hook (c hook)
	(declare (ignore hook))
	(when (find-restart 'abort c)
	  (princ c)
	  (abort c)))

    MY-DEBUGGER-HOOK
    > (setf *debugger-hook* 'my-debugger-hook)

    MY-DEBUGGER-HOOK
    > (/ 1 0)
    Arithmetic error DIVISION-BY-ZERO signalled.
    Operation was KERNEL::DIVISION, operands (1 0).
    > (length 34)
    Type-error in KERNEL::OBJECT-NOT-TYPE-ERROR-HANDLER:
	    34 is not of type SEQUENCE
    > (length 12 34)
    Invalid number of arguments: 2
    > (mapcar '1+ '(12 34 foo 56))
    Argument X is not a NUMBER: FOO.
    > 

And you can always undo it temporarily if you *do* want the full
debugger functionality for a specific expression evaluation:

    > (let ((*debugger-hook* nil))
	(mapcar '1+ '(12 34 foo 56)))

    Argument X is not a NUMBER: FOO.
       [Condition of type SIMPLE-TYPE-ERROR]

    Restarts:
      0: [ABORT] Return to Top-Level.

    Debug  (type H for help)

    (KERNEL:TWO-ARG-+ FOO 1)
    Source: Error finding source: 
    Error in function DEBUG::GET-FILE-TOP-LEVEL-FORM:  Source file no longer exists:
      target:code/numbers.lisp.
    0] 

+---------------
| 2.  Compiler messages. CMU likes to chat and I'm trying to still it.
+---------------

Again, one wonders why. One of the major *advantages* of CMUCL is
its extremely-helpful compiler notes.

+---------------
| I have
|      *COMPILE-VERBOSE*
|      *COMPILE-PRINT*
|      *GC-VERBOSE*
| set to NIL.  However I'm still getting some chat, is there a
| setting I've missed?
+---------------

Are you sure you're getting "chat" and not just the *values*
from the COMPILE-FILE? E.g., this may look like "chat":

    > (compile-file "foo" :print nil :verbose nil)

    #P"/u/rpw3/foo.x86f"
    NIL
    NIL
    >

but it's really just the values from COMPILE-FILE. If you throw
them away, you get nothing:

    > (progn (compile-file "foo-hash" :print nil :verbose nil) 34)

    34
    > 


-Rob

-----
Rob Warnock			<····@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607
From: Carl Shapiro
Subject: Re: minor stuff with CMU Lisp
Date: 
Message-ID: <ouy8xjigog5.fsf@panix3.panix.com>
····@rpw3.org (Rob Warnock) writes:

> Mark Tarver <··········@ukonline.co.uk> wrote:

...

> +---------------
> | 2.  Compiler messages. CMU likes to chat and I'm trying to still it.
> +---------------
>
> Again, one wonders why. One of the major *advantages* of CMUCL is
> its extremely-helpful compiler notes.

If you are writing a compiler where Common Lisp is merely your
high-level intermediate language and COMPILE is the interface to your
back-end, the source-level optimization notes produced by the CMUCL
optimizer may confuse or annoy your users.

There is an optimization flag called EXT:INHIBIT-WARNINGS which will
suppress, among other things, performance notes.  Try compiling these
two functions and witness the difference.

(defun chatty (x y)
  (declare (optimize (speed 3)))
  (+ x y))

(defun still (x y)
  (declare (optimize (ext:inhibit-warnings 3) (speed 3)))
  (+ x y))

This flag is documented in section 4.7.1 of the CMUCL manual.

http://common-lisp.net/project/cmucl/doc/cmu-user/compiler.html#compiler-policy
From: Mark Tarver
Subject: Re: minor stuff with CMU Lisp
Date: 
Message-ID: <1160909161.137093.57950@m7g2000cwm.googlegroups.com>
> > Again, one wonders why. One of the major *advantages* of CMUCL is
> > its extremely-helpful compiler notes.
>
> If you are writing a compiler where Common Lisp is merely your
> high-level intermediate language and COMPILE is the interface to your
> back-end, the source-level optimization notes produced by the CMUCL
> optimizer may confuse or annoy your users.

Exactly right!  

Mark
From: Carl Shapiro
Subject: Re: minor stuff with CMU Lisp
Date: 
Message-ID: <ouy4pu6gnzc.fsf@panix3.panix.com>
"Mark Tarver" <··········@ukonline.co.uk> writes:

> This is for aficionados of CMU Lisp.
>
> I'm experimenting with CMU Lisp and having some
> minor and some not-so-minor problems.  As regards
> the minor stuff.
>
> 1.  Error messages are printed but with the accompanying
>      'Error in function ...." tagged to them; giving the
>      function in which the error was raised.   Actually I
>      don't want this - is there any way to turn this feature
>      off?

You can temporarily re-bind *ERROR-OUTPUT* to suppress these messages.

(defun compile-quietly (&rest args)
  (let ((*error-output* (make-broadcast-stream)))
    (apply #'compile args)))

N.B. calling make-broadcast-stream with no arguments creates a stream
that discards its input.