From: ············@gmail.com
Subject: post declarations in lisp
Date: 
Message-ID: <1175285243.641960.295340@y66g2000hsf.googlegroups.com>
Kent M pitman mentioned in his slashdot article.
The initial focus in Lisp is on getting programs working. You can add
type declarations when you're done if you want to, in order to enable
additional compiler optimizations.
I want to know how  it is done?

From: Lars Rune Nøstdal
Subject: Re: post declarations in lisp
Date: 
Message-ID: <460d7210$0$29072$c83e3ef6@nn1-read.tele2.net>
On Fri, 30 Mar 2007 13:07:23 -0700, ············@gmail.com wrote:

> Kent M pitman mentioned in his slashdot article.
> The initial focus in Lisp is on getting programs working. You can add
> type declarations when you're done if you want to, in order to enable
> additional compiler optimizations.
> I want to know how  it is done?

This is globally set here:

(proclaim '(optimize
            (compilation-speed 0)
            (debug 3)
            (safety 3)
            (space 0)
            (speed 0)))


..then I do:

cl-user> (defun test (a b)
           (+ a b))
test
cl-user> (disassemble 'test)
; 0B2AC989:       64               byte #X64                  ; no-arg-parsing entry point
;      98A:       8B050C000000     mov eax, [#xC]
;      990:       8945CC           mov [ebp-52], eax
;      993:       8B05D8000005     mov eax, [#x50000D8]
;      999:       64               byte #X64
;      99A:       8B00             mov eax, [eax]
;      99C:       8B0D18040005     mov ecx, [#x5000418]
;      9A2:       64               byte #X64
;      9A3:       8B09             mov ecx, [ecx]
;      9A5:       8945D0           mov [ebp-48], eax
;      9A8:       894DD4           mov [ebp-44], ecx
;      9AB:       8965C8           mov [ebp-56], esp
;      9AE:       8B1550C92A0B     mov edx, [#xB2AC950]       ; 'sb-c:debug-catch-tag
;      9B4:       8D4DD8           lea ecx, [ebp-40]
;      9B7:       8B05F8000005     mov eax, [#x50000F8]
;      9BD:       64               byte #X64
;      9BE:       8B00             mov eax, [eax]
;      9C0:       8901             mov [ecx], eax
;      9C2:       896904           mov [ecx+4], ebp
;      9C5:       C7410821CA2A0B   mov dword ptr [ecx+8], 187353633
;      9CC:       89510C           mov [ecx+12], edx
;      9CF:       8B05D8000005     mov eax, [#x50000D8]
;      9D5:       64               byte #X64
;      9D6:       8B00             mov eax, [eax]
;      9D8:       894110           mov [ecx+16], eax
;      9DB:       8B05D8000005     mov eax, [#x50000D8]
;      9E1:       64               byte #X64
;      9E2:       8908             mov [eax], ecx
;      9E4:       64               byte #X64
;      9E5:       813D500000000B000005 cmp dword ptr [#x50], 83886091
;      9EF:       7402             jeq L0
;      9F1:       CC0F             break 15
;      9F3: L0:   8B55F4           mov edx, [ebp-12]
;      9F6:       8B7DF0           mov edi, [ebp-16]
;      9F9:       E84A37D5F5       call #x1000148             ; generic-+
;      9FE:       7302             jnb L1
;      A00:       8BE3             mov esp, ebx
;      A02: L1:   8B0DD8000005     mov ecx, [#x50000D8]
;      A08:       64               byte #X64
;      A09:       8B09             mov ecx, [ecx]
;      A0B:       8B4910           mov ecx, [ecx+16]
;      A0E:       8B05D8000005     mov eax, [#x50000D8]
;      A14:       64               byte #X64

;;; [3] (block test (+ a b))

;      A15:       8908             mov [eax], ecx
;      A17:       8D65F8           lea esp, [ebp-8]
;      A1A:       F8               clc
;      A1B:       8B6DFC           mov ebp, [ebp-4]
;      A1E:       C20400           ret 4
;      A21:       BA0B000005       mov edx, 83886091
;      A26:       E303             jecxz L2
;      A28:       8B53FC           mov edx, [ebx-4]
;      A2B: L2:   8B65C8           mov esp, [ebp-56]
;      A2E:       8BF2             mov esi, edx
;      A30:       8B4DD0           mov ecx, [ebp-48]

;      A33:       8B55D4           mov edx, [ebp-44]
;      A36:       8B05D8000005     mov eax, [#x50000D8]
;      A3C:       64               byte #X64
;      A3D:       8908             mov [eax], ecx
;      A3F:       8B0518040005     mov eax, [#x5000418]
;      A45:       64               byte #X64
;      A46:       8910             mov [eax], edx

;;; [1] (sb-int:named-lambda test (a b) (block test #))

;      A48:       8B7DCC           mov edi, [ebp-52]
;      A4B:       64               byte #X64
;      A4C:       8B150C000000     mov edx, [#xC]

;      A52:       39D7             cmp edi, edx
;      A54:       742C             jeq L5
;      A56: L3:   8B42FC           mov eax, [edx-4]
;      A59:       09C0             or eax, eax
;      A5B:       7410             jeq L4
;      A5D:       8B4AF8           mov ecx, [edx-8]
;      A60:       8B5811           mov ebx, [eax+17]
;      A63:       64               byte #X64
;      A64:       890B             mov [ebx], ecx
;      A66:       C742FC00000000   mov dword ptr [edx-4], 0
;      A6D: L4:   C742F800000000   mov dword ptr [edx-8], 0
;      A74:       83EA08           sub edx, 8
;      A77:       39D7             cmp edi, edx
;      A79:       75DB             jne L3
;      A7B:       64               byte #X64
;      A7C:       89150C000000     mov [#xC], edx
;      A82: L5:   8BC6             mov eax, esi
;      A84:       2407             and al, 7
;      A86:       3C05             cmp al, 5
;      A88:       7513             jne L6
;      A8A:       8BC6             mov eax, esi
;      A8C:       31C9             xor ecx, ecx
;      A8E:       FF75F8           push dword ptr [ebp-8]
;      A91:       FF60FF           jmp dword ptr [eax-1]
;      A94:       90               nop
;      A95:       90               nop
;      A96:       90               nop
;      A97:       90               nop
;      A98:       CC0A             break 10                   ; error trap
;      A9A:       02               byte #X02
;      A9B:       18               byte #X18                  ; INVALID-ARG-COUNT-ERROR
;      A9C:       4D               byte #X4D                  ; ECX
;      A9D: L6:   CC0A             break 10                   ; error trap
;      A9F:       04               byte #X04
;      AA0:       01               byte #X01                  ; OBJECT-NOT-FUN-ERROR
;      AA1:       FE8E01           byte #XFE, #X8E, #X01      ; ESI
; 
nil


Then I add some declarations:

cl-user> (defun test (a b)
           (declare (fixnum a b)
                    (optimize (speed 3) (debug 0) (safety 0)))
           (the fixnum (+ a b)))
style-warning: redefining test in DEFUN
test
cl-user> (disassemble 'test)
; 0B5B0452:       01FA             add edx, edi               ; no-arg-parsing entry point
;       54:       8D65F8           lea esp, [ebp-8]
;       57:       F8               clc
;       58:       8B6DFC           mov ebp, [ebp-4]
;       5B:       C20400           ret 4
;       5E:       90               nop
;       5F:       90               nop
; 
nil

-- 
Lars Rune Nøstdal
http://nostdal.org/
From: ············@gmail.com
Subject: Re: post declarations in lisp
Date: 
Message-ID: <1175286900.309952.104610@p15g2000hsd.googlegroups.com>
On Mar 31, 1:24 am, Lars Rune Nøstdal <···········@gmail.com> wrote:
> On Fri, 30 Mar 2007 13:07:23 -0700, ············@gmail.com wrote:
> > Kent M pitman mentioned in his slashdot article.
> > The initial focus in Lisp is on getting programs working. You can add
> > type declarations when you're done if you want to, in order to enable
> > additional compiler optimizations.
> > I want to know how  it is done?
>
> This is globally set here:
>
> (proclaim '(optimize
>             (compilation-speed 0)
>             (debug 3)
>             (safety 3)
>             (space 0)
>             (speed 0)))
>
> ..then I do:
>
> cl-user> (defun test (a b)
>            (+ a b))
> test
> cl-user> (disassemble 'test)
> ; 0B2AC989:       64               byte #X64                  ; no-arg-parsing entry point
> ;      98A:       8B050C000000     mov eax, [#xC]
> ;      990:       8945CC           mov [ebp-52], eax
> ;      993:       8B05D8000005     mov eax, [#x50000D8]
> ;      999:       64               byte #X64
> ;      99A:       8B00             mov eax, [eax]
> ;      99C:       8B0D18040005     mov ecx, [#x5000418]
> ;      9A2:       64               byte #X64
> ;      9A3:       8B09             mov ecx, [ecx]
> ;      9A5:       8945D0           mov [ebp-48], eax
> ;      9A8:       894DD4           mov [ebp-44], ecx
> ;      9AB:       8965C8           mov [ebp-56], esp
> ;      9AE:       8B1550C92A0B     mov edx, [#xB2AC950]       ; 'sb-c:debug-catch-tag
> ;      9B4:       8D4DD8           lea ecx, [ebp-40]
> ;      9B7:       8B05F8000005     mov eax, [#x50000F8]
> ;      9BD:       64               byte #X64
> ;      9BE:       8B00             mov eax, [eax]
> ;      9C0:       8901             mov [ecx], eax
> ;      9C2:       896904           mov [ecx+4], ebp
> ;      9C5:       C7410821CA2A0B   mov dword ptr [ecx+8], 187353633
> ;      9CC:       89510C           mov [ecx+12], edx
> ;      9CF:       8B05D8000005     mov eax, [#x50000D8]
> ;      9D5:       64               byte #X64
> ;      9D6:       8B00             mov eax, [eax]
> ;      9D8:       894110           mov [ecx+16], eax
> ;      9DB:       8B05D8000005     mov eax, [#x50000D8]
> ;      9E1:       64               byte #X64
> ;      9E2:       8908             mov [eax], ecx
> ;      9E4:       64               byte #X64
> ;      9E5:       813D500000000B000005 cmp dword ptr [#x50], 83886091
> ;      9EF:       7402             jeq L0
> ;      9F1:       CC0F             break 15
> ;      9F3: L0:   8B55F4           mov edx, [ebp-12]
> ;      9F6:       8B7DF0           mov edi, [ebp-16]
> ;      9F9:       E84A37D5F5       call #x1000148             ; generic-+
> ;      9FE:       7302             jnb L1
> ;      A00:       8BE3             mov esp, ebx
> ;      A02: L1:   8B0DD8000005     mov ecx, [#x50000D8]
> ;      A08:       64               byte #X64
> ;      A09:       8B09             mov ecx, [ecx]
> ;      A0B:       8B4910           mov ecx, [ecx+16]
> ;      A0E:       8B05D8000005     mov eax, [#x50000D8]
> ;      A14:       64               byte #X64
>
> ;;; [3] (block test (+ a b))
>
> ;      A15:       8908             mov [eax], ecx
> ;      A17:       8D65F8           lea esp, [ebp-8]
> ;      A1A:       F8               clc
> ;      A1B:       8B6DFC           mov ebp, [ebp-4]
> ;      A1E:       C20400           ret 4
> ;      A21:       BA0B000005       mov edx, 83886091
> ;      A26:       E303             jecxz L2
> ;      A28:       8B53FC           mov edx, [ebx-4]
> ;      A2B: L2:   8B65C8           mov esp, [ebp-56]
> ;      A2E:       8BF2             mov esi, edx
> ;      A30:       8B4DD0           mov ecx, [ebp-48]
>
> ;      A33:       8B55D4           mov edx, [ebp-44]
> ;      A36:       8B05D8000005     mov eax, [#x50000D8]
> ;      A3C:       64               byte #X64
> ;      A3D:       8908             mov [eax], ecx
> ;      A3F:       8B0518040005     mov eax, [#x5000418]
> ;      A45:       64               byte #X64
> ;      A46:       8910             mov [eax], edx
>
> ;;; [1] (sb-int:named-lambda test (a b) (block test #))
>
> ;      A48:       8B7DCC           mov edi, [ebp-52]
> ;      A4B:       64               byte #X64
> ;      A4C:       8B150C000000     mov edx, [#xC]
>
> ;      A52:       39D7             cmp edi, edx
> ;      A54:       742C             jeq L5
> ;      A56: L3:   8B42FC           mov eax, [edx-4]
> ;      A59:       09C0             or eax, eax
> ;      A5B:       7410             jeq L4
> ;      A5D:       8B4AF8           mov ecx, [edx-8]
> ;      A60:       8B5811           mov ebx, [eax+17]
> ;      A63:       64               byte #X64
> ;      A64:       890B             mov [ebx], ecx
> ;      A66:       C742FC00000000   mov dword ptr [edx-4], 0
> ;      A6D: L4:   C742F800000000   mov dword ptr [edx-8], 0
> ;      A74:       83EA08           sub edx, 8
> ;      A77:       39D7             cmp edi, edx
> ;      A79:       75DB             jne L3
> ;      A7B:       64               byte #X64
> ;      A7C:       89150C000000     mov [#xC], edx
> ;      A82: L5:   8BC6             mov eax, esi
> ;      A84:       2407             and al, 7
> ;      A86:       3C05             cmp al, 5
> ;      A88:       7513             jne L6
> ;      A8A:       8BC6             mov eax, esi
> ;      A8C:       31C9             xor ecx, ecx
> ;      A8E:       FF75F8           push dword ptr [ebp-8]
> ;      A91:       FF60FF           jmp dword ptr [eax-1]
> ;      A94:       90               nop
> ;      A95:       90               nop
> ;      A96:       90               nop
> ;      A97:       90               nop
> ;      A98:       CC0A             break 10                   ; error trap
> ;      A9A:       02               byte #X02
> ;      A9B:       18               byte #X18                  ; INVALID-ARG-COUNT-ERROR
> ;      A9C:       4D               byte #X4D                  ; ECX
> ;      A9D: L6:   CC0A             break 10                   ; error trap
> ;      A9F:       04               byte #X04
> ;      AA0:       01               byte #X01                  ; OBJECT-NOT-FUN-ERROR
> ;      AA1:       FE8E01           byte #XFE, #X8E, #X01      ; ESI
> ;
> nil
>
> Then I add some declarations:
>
> cl-user> (defun test (a b)
>            (declare (fixnum a b)
>                     (optimize (speed 3) (debug 0) (safety 0)))
>            (the fixnum (+ a b)))
> style-warning: redefining test in DEFUN
> test
> cl-user> (disassemble 'test)
> ; 0B5B0452:       01FA             add edx, edi               ; no-arg-parsing entry point
> ;       54:       8D65F8           lea esp, [ebp-8]
> ;       57:       F8               clc
> ;       58:       8B6DFC           mov ebp, [ebp-4]
> ;       5B:       C20400           ret 4
> ;       5E:       90               nop
> ;       5F:       90               nop
> ;
> nil
>
> --
> Lars Rune Nøstdalhttp://nostdal.org/

wow ! what a quick reply .. thanks
From: ············@gmail.com
Subject: Re: post declarations in lisp
Date: 
Message-ID: <1175287456.064693.58330@y66g2000hsf.googlegroups.com>
On Mar 31, 1:24 am, Lars Rune Nøstdal <···········@gmail.com> wrote:
> On Fri, 30 Mar 2007 13:07:23 -0700, ············@gmail.com wrote:
> > Kent M pitman mentioned in his slashdot article.
> > The initial focus in Lisp is on getting programs working. You can add
> > type declarations when you're done if you want to, in order to enable
> > additional compiler optimizations.
> > I want to know how  it is done?
>
> This is globally set here:
>
> (proclaim '(optimize
>             (compilation-speed 0)
>             (debug 3)
>             (safety 3)
>             (space 0)
>             (speed 0)))
>
> ..then I do:
>
> cl-user> (defun test (a b)
>            (+ a b))
> test
> cl-user> (disassemble 'test)
> ; 0B2AC989:       64               byte #X64                  ; no-arg-parsing entry point
> ;      98A:       8B050C000000     mov eax, [#xC]
> ;      990:       8945CC           mov [ebp-52], eax
> ;      993:       8B05D8000005     mov eax, [#x50000D8]
> ;      999:       64               byte #X64
> ;      99A:       8B00             mov eax, [eax]
> ;      99C:       8B0D18040005     mov ecx, [#x5000418]
> ;      9A2:       64               byte #X64
> ;      9A3:       8B09             mov ecx, [ecx]
> ;      9A5:       8945D0           mov [ebp-48], eax
> ;      9A8:       894DD4           mov [ebp-44], ecx
> ;      9AB:       8965C8           mov [ebp-56], esp
> ;      9AE:       8B1550C92A0B     mov edx, [#xB2AC950]       ; 'sb-c:debug-catch-tag
> ;      9B4:       8D4DD8           lea ecx, [ebp-40]
> ;      9B7:       8B05F8000005     mov eax, [#x50000F8]
> ;      9BD:       64               byte #X64
> ;      9BE:       8B00             mov eax, [eax]
> ;      9C0:       8901             mov [ecx], eax
> ;      9C2:       896904           mov [ecx+4], ebp
> ;      9C5:       C7410821CA2A0B   mov dword ptr [ecx+8], 187353633
> ;      9CC:       89510C           mov [ecx+12], edx
> ;      9CF:       8B05D8000005     mov eax, [#x50000D8]
> ;      9D5:       64               byte #X64
> ;      9D6:       8B00             mov eax, [eax]
> ;      9D8:       894110           mov [ecx+16], eax
> ;      9DB:       8B05D8000005     mov eax, [#x50000D8]
> ;      9E1:       64               byte #X64
> ;      9E2:       8908             mov [eax], ecx
> ;      9E4:       64               byte #X64
> ;      9E5:       813D500000000B000005 cmp dword ptr [#x50], 83886091
> ;      9EF:       7402             jeq L0
> ;      9F1:       CC0F             break 15
> ;      9F3: L0:   8B55F4           mov edx, [ebp-12]
> ;      9F6:       8B7DF0           mov edi, [ebp-16]
> ;      9F9:       E84A37D5F5       call #x1000148             ; generic-+
> ;      9FE:       7302             jnb L1
> ;      A00:       8BE3             mov esp, ebx
> ;      A02: L1:   8B0DD8000005     mov ecx, [#x50000D8]
> ;      A08:       64               byte #X64
> ;      A09:       8B09             mov ecx, [ecx]
> ;      A0B:       8B4910           mov ecx, [ecx+16]
> ;      A0E:       8B05D8000005     mov eax, [#x50000D8]
> ;      A14:       64               byte #X64
>
> ;;; [3] (block test (+ a b))
>
> ;      A15:       8908             mov [eax], ecx
> ;      A17:       8D65F8           lea esp, [ebp-8]
> ;      A1A:       F8               clc
> ;      A1B:       8B6DFC           mov ebp, [ebp-4]
> ;      A1E:       C20400           ret 4
> ;      A21:       BA0B000005       mov edx, 83886091
> ;      A26:       E303             jecxz L2
> ;      A28:       8B53FC           mov edx, [ebx-4]
> ;      A2B: L2:   8B65C8           mov esp, [ebp-56]
> ;      A2E:       8BF2             mov esi, edx
> ;      A30:       8B4DD0           mov ecx, [ebp-48]
>
> ;      A33:       8B55D4           mov edx, [ebp-44]
> ;      A36:       8B05D8000005     mov eax, [#x50000D8]
> ;      A3C:       64               byte #X64
> ;      A3D:       8908             mov [eax], ecx
> ;      A3F:       8B0518040005     mov eax, [#x5000418]
> ;      A45:       64               byte #X64
> ;      A46:       8910             mov [eax], edx
>
> ;;; [1] (sb-int:named-lambda test (a b) (block test #))
>
> ;      A48:       8B7DCC           mov edi, [ebp-52]
> ;      A4B:       64               byte #X64
> ;      A4C:       8B150C000000     mov edx, [#xC]
>
> ;      A52:       39D7             cmp edi, edx
> ;      A54:       742C             jeq L5
> ;      A56: L3:   8B42FC           mov eax, [edx-4]
> ;      A59:       09C0             or eax, eax
> ;      A5B:       7410             jeq L4
> ;      A5D:       8B4AF8           mov ecx, [edx-8]
> ;      A60:       8B5811           mov ebx, [eax+17]
> ;      A63:       64               byte #X64
> ;      A64:       890B             mov [ebx], ecx
> ;      A66:       C742FC00000000   mov dword ptr [edx-4], 0
> ;      A6D: L4:   C742F800000000   mov dword ptr [edx-8], 0
> ;      A74:       83EA08           sub edx, 8
> ;      A77:       39D7             cmp edi, edx
> ;      A79:       75DB             jne L3
> ;      A7B:       64               byte #X64
> ;      A7C:       89150C000000     mov [#xC], edx
> ;      A82: L5:   8BC6             mov eax, esi
> ;      A84:       2407             and al, 7
> ;      A86:       3C05             cmp al, 5
> ;      A88:       7513             jne L6
> ;      A8A:       8BC6             mov eax, esi
> ;      A8C:       31C9             xor ecx, ecx
> ;      A8E:       FF75F8           push dword ptr [ebp-8]
> ;      A91:       FF60FF           jmp dword ptr [eax-1]
> ;      A94:       90               nop
> ;      A95:       90               nop
> ;      A96:       90               nop
> ;      A97:       90               nop
> ;      A98:       CC0A             break 10                   ; error trap
> ;      A9A:       02               byte #X02
> ;      A9B:       18               byte #X18                  ; INVALID-ARG-COUNT-ERROR
> ;      A9C:       4D               byte #X4D                  ; ECX
> ;      A9D: L6:   CC0A             break 10                   ; error trap
> ;      A9F:       04               byte #X04
> ;      AA0:       01               byte #X01                  ; OBJECT-NOT-FUN-ERROR
> ;      AA1:       FE8E01           byte #XFE, #X8E, #X01      ; ESI
> ;
> nil
>
> Then I add some declarations:
>
> cl-user> (defun test (a b)
>            (declare (fixnum a b)
>                     (optimize (speed 3) (debug 0) (safety 0)))
>            (the fixnum (+ a b)))
> style-warning: redefining test in DEFUN
> test
> cl-user> (disassemble 'test)
> ; 0B5B0452:       01FA             add edx, edi               ; no-arg-parsing entry point
> ;       54:       8D65F8           lea esp, [ebp-8]
> ;       57:       F8               clc
> ;       58:       8B6DFC           mov ebp, [ebp-4]
> ;       5B:       C20400           ret 4
> ;       5E:       90               nop
> ;       5F:       90               nop
> ;
> nil
>
> --
> Lars Rune Nøstdalhttp://nostdal.org/

I presume in first case it was doing type checking and entering debug
information ,right!!!I want to know what other things it do for safety
besides type checking.
From: Johan Ur Riise
Subject: Re: post declarations in lisp
Date: 
Message-ID: <87fy7jemgz.fsf@morr.riise-data.net>
Lars Rune N�stdal <···········@gmail.com> writes:

> On Fri, 30 Mar 2007 13:07:23 -0700, ············@gmail.com wrote:
> This is globally set here:
> 
> (proclaim '(optimize
>             (compilation-speed 0)
>             (debug 3)
>             (safety 3)
>             (space 0)
>             (speed 0)))

On the side, is there some way to discover what is the current global
values of these variables?
From: Thomas A. Russ
Subject: Re: post declarations in lisp
Date: 
Message-ID: <ymi3b3i33oh.fsf@sevak.isi.edu>
Johan Ur Riise <·····@riise-data.no> writes:

> Lars Rune N�stdal <···········@gmail.com> writes:
> 
> > On Fri, 30 Mar 2007 13:07:23 -0700, ············@gmail.com wrote:
> > This is globally set here:
> > 
> > (proclaim '(optimize
> >             (compilation-speed 0)
> >             (debug 3)
> >             (safety 3)
> >             (space 0)
> >             (speed 0)))
> 
> On the side, is there some way to discover what is the current global
> values of these variables?

Not portably.  This also (unfortunately) means you can't access that
information during macroexpansion.

Specific vendors have methods:

  Allegro:  excl:explain-compiler-settings
  


-- 
Thomas A. Russ,  USC/Information Sciences Institute
From: Vassil Nikolov
Subject: Re: post declarations in lisp
Date: 
Message-ID: <m3tzvvd7qd.fsf@localhost.localdomain>
On 02 Apr 2007 13:46:22 -0700, ···@sevak.isi.edu (Thomas A. Russ) said:
| Johan Ur Riise <·····@riise-data.no> writes:
|| Lars Rune N�stdal <···········@gmail.com> writes:
|| ...
|| > (proclaim '(optimize
|| >             (compilation-speed 0)
|| >             (debug 3)
|| >             (safety 3)
|| >             (space 0)
|| >             (speed 0)))
|| 
|| On the side, is there some way to discover what is the current global
|| values of these variables?

| Not portably.  This also (unfortunately) means you can't access that
| information during macroexpansion.

  One of the CLtL2 features (DECLARATION-INFORMATION, p. 210) that did
  not make it into the ANSI standard.

  ---Vassil.


-- 
The truly good code is the obviously correct code.
From: Duane Rettig
Subject: Re: post declarations in lisp
Date: 
Message-ID: <o04pni5jb8.fsf@gemini.franz.com>
Vassil Nikolov <···············@pobox.com> writes:

> On 02 Apr 2007 13:46:22 -0700, ···@sevak.isi.edu (Thomas A. Russ) said:
> | Johan Ur Riise <·····@riise-data.no> writes:
> || Lars Rune N�stdal <···········@gmail.com> writes:
> || ...
> || > (proclaim '(optimize
> || >             (compilation-speed 0)
> || >             (debug 3)
> || >             (safety 3)
> || >             (space 0)
> || >             (speed 0)))
> || 
> || On the side, is there some way to discover what is the current global
> || values of these variables?
>
> | Not portably.  This also (unfortunately) means you can't access that
> | information during macroexpansion.
>
>   One of the CLtL2 features (DECLARATION-INFORMATION, p. 210) that did
>   not make it into the ANSI standard.

However, the Environments Access modiule provides a portable way to
do this, for CL implementations that support it.  On Allegro CL:

CL-USER(1): (sys:declaration-information 'optimize)
((SAFETY 1) (SPACE 1) (SPEED 1) (COMPILATION-SPEED 1) (DEBUG 2))
CL-USER(2): 

Also, if you can get your hands on an environment (say, from a macro
being expanded) you can also discover the current lexical values for
these qualities, for the contour in which the macro call is being
expanded.

-- 
Duane Rettig    ·····@franz.com    Franz Inc.  http://www.franz.com/
555 12th St., Suite 1450               http://www.555citycenter.com/
Oakland, Ca. 94607        Phone: (510) 452-2000; Fax: (510) 452-0182   
From: John Thingstad
Subject: Re: post declarations in lisp
Date: 
Message-ID: <op.tp0y2fmfpqzri1@pandora.upc.no>
On Fri, 30 Mar 2007 22:07:23 +0200, ············@gmail.com  
<············@gmail.com> wrote:

> Kent M pitman mentioned in his slashdot article.
> The initial focus in Lisp is on getting programs working. You can add
> type declarations when you're done if you want to, in order to enable
> additional compiler optimizations.
> I want to know how  it is done?
>

There are a few standard things.

(declaim (inline fun))
(defun fun (val)
   (declare (optimize (speed 3) (safty 0))
            (fixnum val))
   (the fixnum (comp val)))

(declaim (inline..)) to inline a function
http://www.lispworks.com/documentation/HyperSpec/Body/m_declai.htm
http://www.lispworks.com/documentation/HyperSpec/Body/d_inline.htm

declare is for definition of optimations in functions
http://www.lispworks.com/documentation/HyperSpec/Body/s_declar.htm

optimize sets how the compiler prioritates
attributes: size, safety, size, debug -- values from 0 to 3
http://www.lispworks.com/documentation/HyperSpec/Body/d_optimi.htm

Second is declaration of types
http://www.lispworks.com/documentation/HyperSpec/Body/d_type.htm

Third is forcing the return value to be of a type.
http://www.lispworks.com/documentation/HyperSpec/Body/s_the.htm

This is the comprehensive list:
http://www.lispworks.com/documentation/HyperSpec/Body/c_evalua.htm

Optimations are compiler hints.
How they are enforced depends on the Common Lisp implementation.
Therefore also read the documentaion spesific for your compiler.

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
From: Kent M Pitman
Subject: Re: post declarations in lisp
Date: 
Message-ID: <uslb253ba.fsf@nhplace.com>
·············@gmail.com" <············@gmail.com> writes:

> Kent M pitman mentioned in his slashdot article.
> The initial focus in Lisp is on getting programs working. You can add
> type declarations when you're done if you want to, in order to enable
> additional compiler optimizations.
> I want to know how  it is done?

A number of people have already responded on the specifics of what I
wrote, but I worried slightly that you might not be asking the
question "where do I attach my declarations?" but rather "how does
Lisp achieve this general effect of getting the program working before
really fleshing out the program's details?"  (And if you weren't asking
this question, others might have been.)

There are actually several mechanisms that contribute to this effect.
My article
  "Accelerating Hindsight: Lisp as a Vehicle for Rapid Prototyping"
  http://www.nhplace.com/kent/PS/Hindsight.html
discusses some of the mechanisms Lisp has that allow one to easily put
programs together before fussing over details.  It doesn't go into huge
detail, but it's a good starting point for asking more "How do I ...?"
questions.
From: Don Geddis
Subject: Re: post declarations in lisp
Date: 
Message-ID: <87647ypqk2.fsf@geddis.org>
Kent M Pitman <······@nhplace.com> wrote on 14 Apr 2007 12:2:
[...something that isn't important right now...]

Wait a minute!  Was that _the_ Kent Pitman?  Posting again to c.l.l for
the first time in many months (or maybe a year)?

Welcome back!
_______________________________________________________________________________
Don Geddis                  http://don.geddis.org/               ···@geddis.org
I often wonder how come John Tesh isn't as popular a singer as some people
think he should be.  Then, I remember it's because he sucks.
	-- Imitation Deep Thoughts [Age 15]