Generic arithmetic and declarations

Liam Healy lhealy at common-lisp.net
Mon May 18 02:49:35 UTC 2015


On May 17, 2015 9:55 PM, "Harvey Stein" <hjstein at gmail.com> wrote:
>
> Consider the following function:
>
> (defun afunction (a)
>   (declare (type (simple-array  double-float (*)) a))
>   a)
>
> It compiles fine in cl-user, but if I'm in antik-user, I get:
>
>
> ; in: DEFUN AFUNCTION
> ;     (TYPE (SIMPLE-ARRAY DOUBLE-FLOAT (ANTIK:*)) ANTIK:A)
> ;
> ; caught ERROR:
> ;   bad dimension in array type: *
> ;
> ; compilation unit finished
> ;   caught 1 ERROR condition
>
> So, the antik definition of * breaks declarations that use *.
>
> Any way to fix this?
>

You have several options. Antik shadows '* (along with other mathematical
symbols) and an unfortunate side effect is that it affects other uses of
the symbol '* in cl. So, you can just use cl:* (i.e., put the explicit
prefix in). That should always work. There is a symbol macro that defines
'antik:@ to cl:*, so using @ should work. I'm not sure if there's a way to
unshadow a symbol, but you can do something like

(setf antik::*antik-user-shadow-symbols* (remove '#:*
antik::*antik-user-shadow-symbols*))

and then make a new package using antik:make-user-package, which will have
all the use-package and shadowed symbols except *. If you do this, be
careful to use antik:* everywhere you mean Antik's multiply, otherwise it
will assume cl:*.

Liam

> Thanks,
> Harvey
>
>
>
> --
> Harvey J. Stein
> hjstein at gmail.com
> http://www.linkedin.com/in/harveyjstein
> Selected papers and presentations available at:
http://ssrn.com/author=732372
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/antik-devel/attachments/20150517/55ef8566/attachment.html>


More information about the antik-devel mailing list