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

List:       sbcl-help
Subject:    [Sbcl-help] fasl-write / fasl-load
From:       Saupin Guillaume <guillaume.saupin () gmail ! com>
Date:       2014-12-22 10:13:02
Message-ID: CAHwaT36UvJtscidGWZW7Xaub2MRdG-XGx-_duQLfn5X=M6LVHg () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hello,

Is there a fasl-write / fasl-load functionality in sbcl ? I'd like to use
these functions to serialize functions and closures, as shown below (using
Franz lisp) :

In a first lisp repl :

CL-USER(25): (let ((hop "hop"))
  (compile (defun hello () (format t "Hello ~a~%" hop))))

CL-USER(25): (excl:fasl-write (symbol-function 'hello) "/tmp/hello.fasl")


In another repl :

CL-USER(8): (funcall (first (excl:fasl-read "/tmp/hello.fasl")))
Hello hop
NIL

Is this possible with sbcl ? I've tried to use sb-fasl::dump-object.


CL-USER> (let  ((out (sb-fasl:open-fasl-output (pathname "/tmp/hello.fasl")
"hello")))
  (sb-fasl::dump-object (symbol-function 'hello) out))

but it refuses to dump the function, with the following message:

"This object cannot be dumped into a fasl file:"

Is there a way to do that, i.e. save function and close in a fasl file with
sbcl ?

thanks,
-- 
guillaume saupin

[Attachment #5 (text/html)]

<div dir="ltr"><div>Hello,<br><br></div><div>Is there a fasl-write / fasl-load \
functionality in sbcl ? I&#39;d like to use these functions to serialize functions \
and closures, as shown below (using Franz lisp) :<br></div><div><br>In a first lisp \
repl :<br><br>CL-USER(25): (let ((hop &quot;hop&quot;)) <br>   (compile (defun hello \
() (format t &quot;Hello ~a~%&quot; hop))))<br></div><br>CL-USER(25): \
(excl:fasl-write (symbol-function &#39;hello) &quot;/tmp/hello.fasl&quot;)<br \
clear="all"><div><div><br><br></div><div>In another repl :<br><br>CL-USER(8): \
(funcall (first (excl:fasl-read &quot;/tmp/hello.fasl&quot;)))<br>Hello \
hop<br>NIL<br><br></div><div>Is this possible with sbcl ? I&#39;ve tried to use \
sb-fasl::dump-object.<br></div><div><br></div><div><br>CL-USER&gt; (let   ((out \
(sb-fasl:open-fasl-output (pathname &quot;/tmp/hello.fasl&quot;) \
&quot;hello&quot;)))<br>   (sb-fasl::dump-object (symbol-function &#39;hello) \
out))<br><br></div><div>but it refuses to dump the function, with the following \
message:<br><br>&quot;This object cannot be dumped into a fasl \
file:&quot;<br></div><div><br></div><div>Is there a way to do that, i.e. save \
function and close in a fasl file with sbcl \
?<br><br></div><div>thanks,<br></div><div>-- <br><div \
class="gmail_signature">guillaume saupin</div> </div></div></div>



------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk

_______________________________________________
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