libera/#commonlisp - IRC Chatlog
Search
1:11:25
Xach
http://report.quicklisp.org/2021-07-07/failure-report/arrival.html#arrival - this is representative of a number of failures that all seem to fail in fare-utils
1:11:31
Xach
http://report.quicklisp.org/2021-07-07/failure-report.html has more, though not exclusive to that issue
1:23:23
etimmons
Huh. It kinda looks like it's using the `uiop:define-package` macro from uiop 3.3.5, but using the function `uiop:ensure-package` (which it expands to) from a previous uiop.
1:25:59
Xach
well, i load asdf 3.3.1 explicitly, because that's what comes with sbcl. but i also download UIOP as a project as well.
1:28:03
etimmons
Ah.. I have a theory. Do you reuse the fasl cache between builds of different systems?
1:28:39
etimmons
I think some system A that depends on fare-utils also declares an explicit dependency on uiop
1:29:12
etimmons
So when A was built, that latest uiop was loaded and the fasls for fare-utils include the 3.3.5 define-package expansion
1:30:13
etimmons
but fare-utils has no explicit dep on uiop and the chain starting from arrival doesn't have an explicit uiop dependncy or asdf schedules it after loading fare-utils
1:32:50
etimmons
yeah, that's tricky... uiop is such a useful library, but it's special relationship with asdf can be a pain point
1:33:34
etimmons
If you could convince everyone that uses uiop to explicitly declare it as a dep that'd solve it.
1:35:01
etimmons
I wonder what a world would look like where ASDF had a private copy UIOP with different package names.
1:35:52
etimmons
you just would have to explicitly declare it instead of assuming asdf would magically load it for you
1:36:57
Xach
I think UIOP does more than it needs to to support ASDF - some of it could be add-ons to ASDF, and some of it could be completely separated.
1:37:28
Xach
I remember thinking Quicklisp would be sooooo popular I could "fix" stuff in CL because it would be loaded all the time. I'm glad I didn't try doing that.
2:59:26
Josh_2
So I just made a list in a defparameter with '((nil nil nil) (nil nil nil) (nil nil nil)) then used (setf (elt (first <my list>) 0) <my val>) and it changed the val of pos 0 in all the lists, whats up with that? Doesn't do it when I use (list ..)
3:00:48
beach
Josh_2: The compiler coerced all the lists. They are literals so you are not allowed to modify them.
3:05:05
beach
To elaborate, QUOTE creates a "literal object", and the consequences are undefined if literal objects are modified.
3:09:45
Josh_2
I am trying to iterate over a list, if the list item is nil then output a space, otherwise output the item
3:13:53
aeth
whatever emacs uses internally for text isn't good with long lines... I haven't gotten crashes, but I have had it hang which is basically like crashing it
3:16:16
Josh_2
I used ~#[ .. ] within a ~{ ~} and I guess it wasn't consuming the argument as it just kept outputting to stdout
3:40:39
Josh_2
A lot harder than I thought it would be to conditionally display an element (format t "~{~:[ ~;~:*~A~]~^| ~}~%" row))
3:41:53
Josh_2
now if an element within ROW is non nil it is displayed, otherwise a space is displayed
5:46:00
susam
Most of the time I realize that my erroneous code is running in an infinite loop only when the computer's fan goes berserk. I don't realize it in SLIME REPL because the REPL prompt always returns successfully without any output. Do you have another way to realize that your code is running in an infinite loop?
5:46:33
susam
It takes a while to realize that no output + fan noise => infinite loop. It feels disorienting until that realization.
5:47:54
beach
You must be running the code in a separate thread if you get the prompt back. The solution, then, is to run it in the same thread as the REPL.
5:47:56
mfiano
I have stats for cpu and memory utilization visible at all times (on the bottom of my screen, and I'm trained to keep a constant eye on them)
5:50:33
susam
beach: I am not doing threads. For example, here is a simple test case to reproduce what I see. Type (loop) in a code buffer. Then C-c C-c to compile it. SLIME-REPL shows "; processing (LOOP)" with the "CL-USER>" prompt below it.
5:51:10
susam
Now it isn't a new "CL-USER>" prompt. It is the old prompt itself pushed below the "; processing (LOOP)" line.
5:53:31
susam
So the visual feedback for infinite loop is indistinguishable from that due to correct code.
5:54:10
susam
mfiano: Okay. Thanks for the tip. I will set up my environment to show CPU and memory usage too.
5:55:31
mfiano
When you C-c C-c, it is compiled on a background thread with results sent to the repl thread.
5:57:04
susam
pillton: It happens with your loop too but the "here" output gives a visual feedback that I am in an infinite loop, so no disorientation there. This is what the REPL looks like then: https://plaster.tymoon.eu/view/2543
5:57:33
susam
mfiano: Thanks. That makes sense. So that is consistent with what beach said too. The code is compiled in a background thread.
5:57:33
mfiano
This is important to realize, because if you have a continuous render/event loop or some such, you will need a thread-safe queue to process class redefinitions.
5:58:09
pillton
susam: I don't understand. C-c C-c compiles the "current toplevel form". It doesn't evaluate it.
6:01:29
susam
pillton: What happens if you C-c C-c this in your Lisp buffer: (dotimes (n 10) (print n)). Does it not end up printing 0 1 2 ... 10 in your REPL?
6:04:05
susam
pillton: Yes, that was a disconcerting for me too when I began learning CL with SLIME. But gradually got used to it. For example, C-c C-c is mapped to slime-compile-defun but it can compile any top-level form.
6:04:21
susam
To be fair to the doc, it does spell it out clearly. "The code for the region is executed after compilation. In principle, the command writes the region to a file, compiles that file, and loads the resulting code."
6:05:41
susam
I now realize I should ask more of these questions in this channel. Lot to learn. I have been coding like a caveman for so long.
6:07:31
susam
Interesting, it indeed does not. It probably should, otherwise the behaviour can be confusing. I quoted the documentation from here: https://common-lisp.net/project/slime/doc/html/Compilation.html
7:46:01
sm2n
mfiano, do you have any examples of that (event loop class redefinitions with a threadsafe queue)?
7:47:14
mfiano
That is pretty domain-specific code...I have a few private examples, but spread out across a large project, so not worth sharing
7:49:39
sm2n
could you at least outline how it should work? I didn't know you could queue class redefinitions up
7:53:07
mfiano
Well the issue is, that there is a bit of implementation-specific behavior regarding when and how the generic accessors of a defclass should be recompiled, and since SLIME compiles on a dedicated compilation thread and not your application thread, there could be a slight instance in which the slots are non-existant, or no applicable methods exist. If you require live-redefining classes (or your
7:53:09
mfiano
users do), a solution would be to write a macro that expands into a thunk which calls defclass, and call that function in your main thread as you pop items off of your locking queue.
7:53:44
mfiano
I do this in my game engine. At worst though, if you don't do any of this, you'll just be presented with the debugger for a single frame, in which you can hit the continue restart.
7:54:40
sm2n
"When the class C is redefined, changes are propagated to its instances and to instances of any of its subclasses. Updating such an instance occurs at an implementation-dependent time, but no later than the next time a slot of that instance is read or written. "
7:55:53
mfiano
I think the underlying problem is that when you recompile a defclass, the methods for the generic function accessors are removed, and then re-added.
8:01:04
mfiano
It's a rare bug to encounter, you'd have to be calling a slot accessor fast enough, or lucky enough to hit it at the exact moment during the redefinition between method removal and addition.
8:01:22
mfiano
and when you do encounter it, it's non-fatal, as you can just issue the continue restart.
8:26:32
phadthai
multithreaded lisp largely chose what is protected by locks or not and it's also a performance tradeoff, I suspect the above is related and needs an explicit lock
8:28:52
phadthai
and concurrency was not part of the standard; I think that the only fairly agreed thing is that dynamically scoped variables can be used as thread-specific contexts
12:55:22
jmercouris
is there a way to actually obtain `(lambda () (print "tomatoes are great"))` from xyz?
13:01:29
Bike
in general the source of a function still isn't going to be enough to serialize it, e.g. for closures