[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sbcl-help
Subject:    Re: [Sbcl-help] Function redefinition type error
From:       Richard M Kreuter <kreuter () progn ! net>
Date:       2015-03-20 14:56:13
Message-ID: 30051.1426863373 () frotz ! progn ! net
[Download RAW message or body]

It's conforming of the implementation. See CLHS 3.2.2.3, bullet number
5:

http://www.lispworks.com/documentation/HyperSpec/Body/03_bbc.htm

"A call within a file to a named function that is defined in the same
file refers to that function, unless that function has been declared
notinline. The consequences are unspecified if functions are redefined
individually at run time or multiply defined in the same file."

So for code you control, declare the functions you wish to redefine
notinline.

Gregory Tod writes:
> Hi there,
> 
> Below is a file which if you save as foo.lisp, start a command line
> sbcl, and then follow the included instructions leads to the type error
> shown, at least on my 64 bit Linux.
> 
> (Of course one would not normally do such a thing but I'm trying to
> redefine a function in yason to return an fset map rather than a
> hash-table and this is the smallest case I could make out of it).
> 
> My CLHS knowledge is not deep enough to tell me if this is conforming or
> not.  If it is conforming I'd appreciate some pointers to why and how it
> is.
> 
> If it is not I'd appreciate some advice on how best to work around it.
> 
> Many thanks,
> 
> Greg
> 
> ----
> 
> (in-package :cl-user)
> 
> (defun foo ()
>   nil)
> 
> (defun bar ()
>   (let ((value (foo)))
>     value))
> 
> #|||
> 
> This is SBCL 1.2.4.debian, an implementation of ANSI Common Lisp.
> 
> * (compile-file "foo.lisp")
> (compile-file "foo.lisp")
> 
> ; compiling file "/tmp/foo.lisp" (written 19 MAR 2015 09:06:45 PM):
> ; compiling (IN-PACKAGE :CL-USER)
> ; compiling (DEFUN FOO ...)
> ; compiling (DEFUN BAR ...)
> #P"/tmp/foo.fasl"
> 
> * (load "foo")
> T
> 
> * (bar)
> NIL
> 
> * (defun foo () 7)
> STYLE-WARNING: redefining COMMON-LISP-USER::FOO in DEFUN
> FOO
> 
> * (bar)
> debugger invoked on a TYPE-ERROR in thread
> #<THREAD "main thread" RUNNING {10039CE4E3}>:
>   The value 7 is not of type NULL.
> 
> |||#
> 
> -----------------------------------------------------------------------------
> -
> Dive into the World of Parallel Programming The Go Parallel Website, sponsore
> d
> by Intel and developed in partnership with Slashdot Media, is your hub for al
> l
> things parallel software development, from weekly thought leadership blogs to
> news, videos, case studies, tutorials and more. Take a look and join the 
> conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Sbcl-help mailing list
> Sbcl-help@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sbcl-help
> 

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Sbcl-help mailing list
Sbcl-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sbcl-help
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic