freenode/#lisp - IRC Chatlog
Search
19:17:27
doanyway
is there something similar to a study path for game programmer for common lisp ? I am still working through pcl
19:32:00
doanyway
jackdaniel: not for games but what books should I progress through to get proficient at common lisp
19:33:31
jackdaniel
sweat and tears ;) you won't make a mistake if you study paip (which was recently released to download for free)
19:37:47
doanyway
White_Flame: I finished land of lisp - pcl has been more helpful for my understanding
20:03:16
webchat296_
Hello SBCL question. What I have to do make sure when I execute the saved lisp image it gives me a REPL after executing the toplevel lambda? Currently it executes the toplevel and quits. (sb-ext:save-lisp-and-die "./sayhello" :toplevel #'(lambda () (format t "hello")) :executable t)
20:03:40
webchat296_
SBCL question. What I have to do make sure when I execute the saved lisp image it gives me a REPL after executing the toplevel lambda? Currently it executes the toplevel and quits.
20:10:00
webchat296_
does any quicklisp library provide this functionality? i.e. i save an image by calling a function with something like :repl t
20:12:04
Bike
there are some libraries that provide uniform interfaces to dumping images. there's asdf/image forone. i don't know much about them.
20:13:01
Bike
but also, if all you'redoing is executing something before going back to the normal repl, you could just pass --eval options to the executable
20:17:40
webchat296_
i have some data that i don't want to reload all the time. it lives in the image. something like this:
20:18:50
webchat296_
so what i want is, after i run the saved image .. i have access to *foo* in a repl and i keep on playing with the data
20:19:41
jasom
I can't be the only one to wish that unwind-protect was of the form (unwind-protect cleanup-form &body protected-forms) right?
20:25:35
makomo
i think i might have interested yet another guy for lisp. examples are the key it seems. :-)
20:42:23
jasom
webchat296_: yeah, sorry I didn't read the entire scrollback, you just omit :toplevel and it will do what you want
20:43:02
webchat296_
jasom: i saved an image with :executable nil then did the following in the shell
20:45:23
jasom
webchat296_: my mistake, just leave out the :toplevel (lambda ...) and it will give you a repl by default
20:49:11
webchat296_
jasom: cool it worked! guess i have to look into asdf/image as Bike mentioned to set hooks after image restore
20:52:02
jasom
webchat296_: I don't think the uiop image functions give you access to the default toplevel, but I may be wrong
21:04:28
jasom
webchat296_: internally uiop replaces the toplevel function with one that calls its own hooks
21:06:50
jasom
If you only want to use sbcl, then you can set *image-entry-point* to be sb-impl::toplevel-init and it should work, but that's specific to sbcl
21:09:02
Bike
webchat296_: "[save lisp and die] corrupts the current Lisp image enough that the current process needs to be killed afterwards." says the sbcl manual.
21:12:49
jasom
webchat296_: note that using sb-impl::toplevel-init as the entry point is a hack, you may want to ask on sbcl if there is a better way to save an image that can run some hooks and then enter the REPL.
21:13:56
jasom
If this is just a quick-and-dirty environment you're using for a few days and will throw away, maybe don't spend time on finding the Right Way, but otherwise it may be worth digging deeper
21:14:10
aeth
Data you don't want to reload all of the time? If you make really-big-data in a macro, you can do this (I use it with shaders) to create what effectively becomes a compile time constant: (defmethod make-load-form ((object shader) &optional environment) (make-load-form-saving-slots object :environment environment))
21:14:38
aeth
Then the functions I create with define-shader are trivial functions that just return the constant shader object, with a constant shader source string, etc.
21:17:11
aeth
Oh, in case I was unclear, I have a macro define-shader that creates the shader object... in the macro. So it goes roughly like this: `(defun ,name () ,(make-instance 'shader ...)) where all of the slots are created by functions run at the macro time, not at runtime.
21:18:13
jasom
webchat296_: that looks like it will do what you want and you can just use the sb-ext:save-lisp-and-die without a :toplevel
21:21:04
webchat296_
jasom: cool. now my goal is to fork the process and do the image-dumping in the child. then the parent lives on and i get to save snapshots.
21:41:48
simplegauss
i think i have found a rather strange optimization bug in sbcl, can anyone explain why this happens and/or how to get around it and if it really is a bug? code: https://pastebin.com/z3pb4nA9 . the problem is that it appears if i have a macro that expands to a lambda function, it is optimized differently than if it is handwritten, which is very confusing to me. More confusingly, if I add a layer of "flet" (please see code) to the macro,
21:41:48
simplegauss
the optimization kicks in properly again, despite the fact i'm just copying the same code twice (again, this is confusing in text but clear in the short example)
21:53:10
pfdietz2
This has been fixed in the SBCL repo I believe. Build SBCL from current source and see if it fixes it.
21:57:02
simplegauss
pfdietz2: great! now the scary question: is there a guide to building SBCL on windows? it seems to even be a few versions back on the website
21:58:29
simplegauss
pfdietz2: and from an academic point of view, do you know why such a thing happened? it seems it should have been impossible in any reasonable implementation of macroexpansion
22:06:03
jasom
webchat296_: FYI forking on sbcl is only supported if you haven't created any threads
22:20:45
webchat296_
jasom: is that so? ah .. then do I have to kill all "non-main" threads before doing the fork?
22:23:19
jasom
webchat296_: I think that will work. The issue is that sbcl in the child process doesn't know the fork has happend, and threading plus fork() isn't really well defined to begin with, so if the GC is invoked off of the main thread, Bad Things happen.
22:27:26
webchat296_
jasom: what did you mean when you said "the child process doesn't know the fork has happend" ?
22:29:15
jasom
webchat296_: obviously sb-posix:fork could be changed to do all the work that it required for this to work correctly, but it would be non-portable since posix doesn't define what happens to pthreads on fork
22:32:28
jasom
webchat296_: I think there is a single-threaded slime option, but you lose some features
22:34:26
fe[nl]ix
jasom: what do you mean by "posix doesn't define what happens to pthreads on fork" ?
22:35:26
p_l
though if you have full control over threads in your application, you can actually do a safe fork() with threads
22:35:47
jasom
sorry, it's actually safe so long as you only call async-signal-safe operations until exec is called
22:36:09
jasom
A process shall be created with a single thread. If a multi-threaded process calls fork(), the new process shall contain a replica of the calling thread and its entire address space, possibly including the states of mutexes and other resources. Consequently, to avoid errors, the child process may only execute async-signal-safe operations until such time as one of the exec functions is called. [THR] [Option
22:36:11
jasom
Start] Fork handlers may be established by means of the pthread_atfork() function in order to maintain application invariants across fork() calls
22:37:16
p_l
I believe the problem is getting all threads to sane state in usual programs (read C-derived)
22:40:22
jasom
fe[nl]ix: ah, there are no threads in the child process, so as long as you don't cons, it won't invoke the GC?
22:41:18
jasom
ACTION was using spawn for something, but the lack of a chdir in spawn was making things difficult
22:41:57
fe[nl]ix
so what's safe is to fork, and the child only accesses memory that was allocated outside the GC heap, e.g. stack / C heap / mmap'd memory
22:44:34
jasom
fe[nl]ix: well I can handle windows in it's own file if I have a unix one that works widely without people having to install a non-lisp library or have cc in their path
22:46:18
fe[nl]ix
and rebuild a new SBCL binary with openssl and libfixposix statically linked whenever there's a release or a security update
22:48:29
fe[nl]ix
I would distribute those binaries, and people can use them instead of the official ones
23:28:29
gonzojive
Straw poll: which SLIME completion algorithm do you use? I have been using slime c-p-c, but I'm curious about fuzzy completion
0:43:24
simplegauss
pfdietz: i just compiled the latest sbcl and tested my code, the optimization bug is still there
2:17:34
sea
Hey, is there a way to write an array to disk (format f "~S" ...) along with its type? When I read the array back in, the element-type is gone
2:35:01
beach
sea: No, there is not predefined printed representation for specialized array. You would have to invent your own.
2:37:21
Kevslinger
Indeed. We left Marbella Wednesday morning, and arrive in Philadelphia Wednesday late afternoon.
2:39:20
Kevslinger
The day we left, Philly was very warm. During ELS, it snowed in Philly. This morning, it was very cold, then in the afternoon it was beautifully warm, and now tonigh it is cold again. This weekend is projected to be wonderful, though, so I am looking forward to that.
2:45:51
Colleen
Weather in Philadelphia: Clear at 6°C (feels like 4°C), 48% humidity, 2km/h wind, 1029hPa pressure.
2:53:44
Kevslinger
That is truly unbelievable. The humidity of Pennsylvania is one of my least favorite parts about it. Couldn't imagine even more water in the air