libera/#commonlisp - IRC Chatlog
Search
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
13:13:45
polygon-op
being able to see the source code of the commercial system doesn't mean that it could be copied (that would depend on the license)
13:25:46
jmercouris
is there a way to see who has a reference to something preventing it from being GC'd?
13:28:19
beach
If you track everything, you are pretty much preventing it from being garbage collected, unless you use weak references.
13:30:57
Bike
what the thing i'm recalling does is give you a path from roots to a given object. since the object you're looking for is already alive for some reason, you're not making it any more impossible to collect
13:39:52
_death
(setf (gethash path *data-paths*) path) <- the hash table is weak only on keys.. if the value is path, then it defeats the purpose
17:29:20
jcowan
Indeed, in mainframe days (when clanking iron dinosaurs ruled the Earth), most customers got source under NDA, because they expected to customize it.
17:37:04
Bike
replace behaves normally if the source and destination are the same sequence, though not if array displacement causes sharing
17:46:44
Bike
there are some array libraries, but i've never personally needed them, so i can't tell you much there
17:47:56
aeth
most array libraries are going to be restricted to popular uses of arrays, such as FFI and/or graphics/lin-algebra
17:49:59
jcowan
My first attempt to define an array library for Scheme (with arrays implemented on top of vectors, which are primitive) followed CL closely.
17:50:28
_death
if it's a single row or so, you could use displaced arrays.. Lisp Machine Lisp also had conformal arrays
17:50:54
jcowan
Then along came Brad Lucier, a *real* array user, who said "No, no, that's all wrong!" and designed a really compelling library, with things like read-only arrays, a bunch of composable affine transfomers (a long chain runs just as fast as a single transformerP, lazy mapping, etc. etc.
17:51:52
jcowan
you can also provide an arbitrary getter (and optionally a setter) and get an array defined by them plus the shape, so it can do anything you want.
17:51:52
dieggsy
jcowan heck yeah i love his array library, i posted it to chicken. unfortunately i haven't schemed in a couple months cause my job is taking all of my brain energy
17:54:07
Josh_2
Does the :type key in defclass mean that every time I set the value of that slot it gets type checked again?