libera/#commonlisp - IRC Chatlog
Search
2:06:09
elderK
It's been a pretty long time since I posted here: There seem to be some neat new developments floating about like rpav's cl-autowrap and c2ffi.
2:06:46
elderK
I was wondering if there are any good resources, bar the GitHub page itself, describing how to best use cl-autowrap?
2:06:46
elderK
Could anyone give me a rundown as to why I'd want to use it vs. CFFI's groveler and stuff?
2:07:17
phoe
elderK: a brief and bad example of cl-autowrap is https://github.com/phoe/cl-lzma/blob/master/cl-lzma.lisp
2:08:00
elderK
Also, as a kind of side question: How do you debug your programs? I'm curious as to how you say, step through a Lisp program.
2:08:00
elderK
On YouTube, I've seen some people edit quite complex programs through SLIME. Say Baggers with his graphics videos.
2:08:00
elderK
I was wondering how this works if you have a multithreaded program? Do you have one thread dedicated to running the REPL? Is it simpler than that, more complex?
2:09:06
phoe
depending on the structure of your program, maybe the erroring thread can "forward" the condition to another thread and wait for it to get somewhat handled there - but that is something of a more complex approach where you also don't have the stack visible by default in the slime debugger
2:09:22
phoe
so probably the best way is to let the thread crash and enter the debugger at which point you can, well, debug that thread
2:09:26
elderK
Interesting. I was curious how like, recompiling parts of a program would work in a multithreaded environment.
2:10:15
phoe
if you have anything more complex than that, like needing to replace several bindings at once, you may need to stop other threads before doing this
2:10:33
elderK
I've recently decided I'd like to start moving to CL for pretty much all my personal projects. I'm starting to grow a little disenchanted with modern C++ and stuff. Sure, it's great and has lots of features but keeping up to date is increasingly hard and template metaprogramming remains black magic.
2:10:33
elderK
CL seems much more inviting: The metaprogramming language is the same as the core language.
2:11:07
elderK
Phoe: So to be safe, you kind of need to develop your software with reloading in mind?
2:11:55
phoe
depends on what you mean by reloading and what is the "transaction" that contains things that are to be reloaded
2:12:27
Bike
slime usually has a thread for the repl and some other threads. you can run it in a single threaded mode if you want, though
2:14:43
elderK
Another question I have is how does reloading the entire program, or parts of the program, work when you are using the FFI?
2:14:43
elderK
Unless you handled it nicely in some way, wouldn't you leak resources or maybe just crash entirely?
2:18:20
elderK
:) Also, back to the debugging question: How do you debug your stuff? How do you go about setting breakpoints and stuff?
2:19:17
phoe
the FFI stuff is not a problem unless you unwind your stack, because of UNWIND-PROTECTs along the way
2:19:37
phoe
and most of the time when debugging live programs you do not unwind past the point of freeing these resources
2:22:39
elderK
Is there any point in using CFFI directly as opposed to cl-autowrap? I guess the same can be asked about your implementation's FFI layer directly.
2:24:18
elderK
I figure if you're only going to be using a few functions from some library, you might as well just wrap those yourself.
2:25:10
elderK
I've seen repos that contain a lot of "spec" files I assume are generated by cl-autowrap via c2ffi. It seems to support everything, you'd need to do a build on all platforms.
2:27:46
phoe
ideally the community comes in on every step of the software development process where it is necessary
2:30:51
elderK
Other than just diving in and starting to build stuff, is there anything I can do to learn about CL as quickly as possible?
2:30:51
elderK
As it is, I like to read about Lisp although since I've not really used it for serious work, much of what I have read has decayed.
2:31:25
minion
elderK: look at pcl: pcl-book: "Practical Common Lisp", an introduction to Common Lisp by Peter Seibel, available at http://www.gigamonkeys.com/book/ and in dead-tree form from Apress (as of 11 April 2005).
4:02:33
paulapatience
<elderK> ":) Also, back to the debugging..." <- Sly provides stickers that store the values of forms when they are executed, and you can play them back at will (I don't know about Slime, as I don't use it). Also, you can insert (break) statements where you will. There's also (trace).
4:08:23
beach
paulapatience: But here is my favorite scenario: My program encounters a condition that is caught by the debugger, and there is a restart that I can use, and the restart will continue executing one of the functions already on the stack, say F. Before continuing, I would like to put a breakpoint in F at some point after the current function call done by F.
4:08:25
beach
But I can't. To use a BREAK form, I have to recompile F, and then it is not the same function as the one on the stack. In general, debugging techniques that require you to debug a different program from the one that exposed the issue are not desirable.
4:24:24
beach
But if we had a real debugger and if our Common Lisp systems allowed us to set breakpoints in existing compiled code, I could have done it.
4:26:01
beach
Since you can't set an arbitrary breakpoint, you can't execute up to a break point and then step after that. You have to step from the beginning.
4:26:43
paulapatience
Hah, I never thought about that. I didn't realize that we can't set breakpoints like in other languages
4:27:29
beach
paulapatience: It is not the language. It is just that our free Common Lisp implementations don't allow it, or at least not in a way that can be exploited.
4:28:47
beach
I researched the capabilities of all commonly used Common Lisp implementations for this paper: http://metamodular.com/SICL/sicl-debugging.pdf
4:28:53
paulapatience
I've already used edebug for elisp, but I never got around to wondering why I couldn't do that in CL
4:30:04
beach
The sad thing is that SBCL maintained the breakpoint capability of CMUCL, but it is used only for tracing.
4:30:48
beach
Since it is not documented, I am not sure this mechanism would be safe to use in a debugger. Plus, of course, we don't have a debugger in the first place.
4:35:08
beach
So here we are, with an excellent language with excellent capabilities for introspection, and with a fantastic condition system. But it is more comfortable to debug C programs with GDB than to debug Common Lisp programs with our current free tools.
4:39:26
paulapatience
So if I understand correctly, we can't reuse SICL's debugger in other implementations
4:39:58
paulapatience
But the section describing Clordane seemed to suggest you could compile the application with SICL and then run it in another implementation
4:40:13
beach
You would need to convince the maintainers of existing Common Lisp implementations to add such support.
4:42:12
beach
You could of course develop your program with a Common Lisp implementation that allows all this debugging support, and then run it in production after compiling it with (say) SBCL.
4:43:16
beach
We do execute SICL code inside a host Common Lisp system, but only for the purpose of bootstrapping.
4:44:58
paulapatience
What is the general status of SICL, anyway? I first heard about it in #clasp, so I guess parts of it are used there
4:46:36
Bike
there's also a few bits of sicl in the runtime, like the definitions of shiftf and rotatef off the top of my head.
4:49:35
paulapatience
(Currently really hypothetically, since I'm quite busy with my studies at the moment, but possibly eventually)
4:49:50
beach
paulapatience: Currently, it is not practical to contribute to the essence of SICL, which is the bootstrapping procedure. But you could work on a library that implements some standard feature, like Parcl for the package system, for instance.
4:51:52
beach
paulapatience: The thing with SICL is that we seem to move towards a situation where there is pretty much only the bootstrapping procedure left, and the rest is imported as implementation-independent libraries.
4:52:42
paulapatience
Bike: Keeping in mind that I've never worked on a compiler before, this is something that would definitely interest me
4:53:09
beach
They are "implementation independent", but in fact, it is pretty much required to use something like SICL bootstrapping procedure in order to make them part of a new Common Lisp implementation.
4:54:40
paulapatience
beach: Working on those libraries sounds good to me as well. I've perused a few of them to try to learn things
4:55:17
beach
Well, these are libraries that implement some part of the standard, so special care would have to be taken in the implementation strategy.
4:55:53
Bike
(clasp also uses the CLOS discrimination mechanism beach came up with, but it's an original implementation instead of reused code)
4:56:25
paulapatience
Bike: Well, ok, if you find some self-contained, not urgent task you think might be good for me, I'd gladly give it a shot
4:56:30
beach
And I would like to turn phoe's condition system into one that can be used intrinsically too.
4:59:25
Bike
"self-contained" might be a challenge... some stuff i'd like to do is witch to using trucler instead of its homegrown environment system, and porting the various particular type derivers and optimizations that are currently clasp-specific (but shouldn't require much understanding of clasp)
5:02:12
paulapatience
Bike: where in the source should I start reading? (I can start familiarizing myself with it, but writing any code will have to wait until I finish my predoc exams in two weeks)
5:04:44
paulapatience
That's good. I also tend to take on more projects than I am able to handle at once, but I've been wanting to contribute to SICL, Clasp, etc., for some time
5:05:17
Bike
i would start with the documentation website, and the cleavir-example system to get an idea of how things function overall
10:26:11
Shinmera
Pathnames on their own without open/etc are fairly useless, and those you can only implement if you can implement streams, etc.
10:27:46
Shinmera
I have written two libraries to help with wrangling pathnames; pathname-utils and filesystem-utils.
10:34:46
buffet
question about specificity with multiple inheritence: if i have A extends B, and X extends Y, then i make a new class K which extends A, X. does B or Y have higher specificity for K?
10:41:08
jackdaniel
buffet: this describes the algorithm for standard classes: http://www.lispworks.com/documentation/HyperSpec/Body/04_ce.htm
10:43:14
pve
Wow, I was just wondering how the class precedence list is computed, and then a link magically appears :)
10:55:44
buffet
struggling a bit to invoke c2mop:compute-class-precedence-list, i got http://0x0.st/oCII.txt
11:28:08
jackdaniel
it is nice if your implementation provides a method specialized on a symbol but it is not required
11:28:54
jackdaniel
unless you really really insist on the implementation doing the work to compute it /again/