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?
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?
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
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.
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
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/
·············@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.
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]