[Ecls-list] Function type proclaimations not working?
Juan Jose Garcia-Ripoll
juanjose.garciaripoll at gmail.com
Sat May 25 21:53:42 UTC 2013
On Fri, May 17, 2013 at 12:51 AM, Jason Sewall <jasonsewall at gmail.com>wrote:
> On Thu, May 16, 2013 at 3:42 PM, Juan Jose Garcia-Ripoll
> <juanjose.garciaripoll at gmail.com> wrote:
> > You are looking at the _old_ manual. That section is obsolete, but I did
> > have time to go through the whole manual again.
> Sorry, it wasn't clear to me that it was "old" - I got it from a doc
> tree I recently built from the ecl-doc repo. Should such parts be at
> least marked with *obsolete* somehow if there is no time for updating?
ECL demands more time than I have and the docs have become obsolete. The
sources for the documentation are open and I welcome patches and bug
reports for them.
> > That said, ECL no longer implements unboxed functions. It was very hard
> > maintained and lead to code bloat: we had to provide two functions for
> > signature, one with Common Lisp objects, another one with unboxed
> values. It
> > could be reimplemented using appropriate proclamations, but the default
> > action was to remove it.
> > Outside from function arguments, the rest can be fully unboxed, as you
> > in the new code body, which is also more readable.
> This seems sensible to me, but it doesn't really explain the warning I
> got, does it? Shouldn't the compiler just ignore the proclamation in
> that case instead of apparently failing to understand it?
Well, your code was broken. As shown here:
http://clhs.lisp.se/Body/f_procla.htm the list of valid declaration
identifiers for PROCLAIM does not include FUNCTION. Your proclamation
should have read instead
(proclaim '(ftype (function (fixnum fixnum fixnum) fixnum) tak)))
(defun tak (x y z)
(declare (fixnum x y z))
(if (not (< y x))
(tak (tak (1- x) y z)
(tak (1- y) z x)
(tak (1- z) x y))))
With this, ECL does not complain
> (compile-file "foo.lsp")
;;; Compiling foo.lsp.
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
;;; Compiling (DEFUN TAK ...).
;;; End of Pass 1.
;;; Emitting code for TAK.
;;; Finished compiling foo.lsp.
Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the ecl-devel