<ixelp>
GitHub - ruricolist/cloture: Clojure in Common Lisp
<skin>
maybe I can use it to move some of my old clojure code to CL which would be great.
<skin>
In any case, I used to think immutable was inherently better, and it often is, but string mutability hasn't come up for me as a problem in my coding yet.
fererrorocher has quit [Quit: WeeChat 4.2.1]
<skin>
However, if you're a fan of fset, you may wish to look at https://git.sr.ht/~skin/jfon . I made a library to slurp json into fset because that was the biggest blocker for me to using fset.
<ixelp>
~skin/jfon - Porting the Common Lisp (CL) JZON library to serialize FSet objects. - sourcehut git
fererrorocher has joined #commonlisp
thanosapollon has quit [Quit: Goodbye, friend]
thanosapollo has joined #commonlisp
<pfdietz>
Interesting
josrr has joined #commonlisp
wacki has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
fe[nl]ix has quit [Remote host closed the connection]
cage has joined #commonlisp
fe[nl]ix has joined #commonlisp
amb007 has quit [Ping timeout: 260 seconds]
amb007 has joined #commonlisp
phantomics has quit [Quit: Leaving]
phantomics has joined #commonlisp
phantomics has quit [Client Quit]
phantomics has joined #commonlisp
<phantomics>
Does anyone know what would cause an FFI function to produce this error? fatal error encountered in SBCL pid 2011719 tid 2011738: no size function for object at 0x1039c80000 (widetag 0x1)
<phantomics>
This comes from using cl-portaudio to monitor a Linux sound device. The listening is done in a dedicated lparallel thread. This works fine if that thread is the only thing running but if I have anything going on in a separate lparallel thread, the SBCL instance crashes with this message
nij- has joined #commonlisp
mariari has quit [Quit: WeeChat 4.2.1]
<bike>
that appears to be a pretty low level error from the GC indicating that it doesn't know how to figure out how large an object in memory is. I'm going to guess that that indicates that something that is not an actual lisp object is being treated as a lisp object, but it's only a guess.
ym has joined #commonlisp
jon_atack has quit [Ping timeout: 252 seconds]
mariari has joined #commonlisp
<phantomics>
Thanks, cl-portaudio has a stream object that numbers are read from representing the incoming audio, it could be to do with that
kevingal has quit [Ping timeout: 268 seconds]
<phantomics>
Is there any means by which I could find what was at the given address? (0x1039c80000 above) A bit tricky since the instance had crashed and gone to ldb by the time it appeared
mrcom has quit [Quit: Leaving]
b00p has joined #commonlisp
chiselfuse has quit [Remote host closed the connection]
chiselfuse has joined #commonlisp
chiselfuse has quit [Remote host closed the connection]
treflip has quit [Quit: Quit]
chiselfuse has joined #commonlisp
<bike>
if i understand the error correctly, sbcl does not know what kind of object is at the given address. ldb probably has some way to look at the memory raw but i don't know how
molson has quit [Remote host closed the connection]
<nij->
Anyone familiar with FSET? I'm wondering.. if this may cause a "bug". https://bpa.st/4QFA
<ixelp>
View paste 4QFA
<nij->
So basically, two threads will throw things into the bag B, and assign the newly created bag to B again.
<bike>
never used fset, but the manual says "Note that this implementation is not synchronized. If multiple threads access a set concurrently, and at least one of the threads modifies the set, it must be synchronized externally. This is typically accomplished by synchronizing on some object that naturally encapsulates the set."
<bike>
so i'm guessing that will go poorly
molson has joined #commonlisp
<nij->
What if both threads get to B at the same time, both create a new bag? Wouldn't the end result has one item less than expected?
<bike>
oh, wait, that's about java
<bike>
gotta read slower
<nij->
I get that the bag is immutable. But the value slot of the symbol B is.
<nij->
So I don't know how this has solved the problem..
<nij->
In my use case, I haven't observed any issue yet. But I can't be sure that it will never.
<bike>
okay, so the fset manual instead says "Remember that isetq is for interactive use only, not in programs!"
<bike>
so i'm going to stick with my advice of don't do this
<nij->
Hmm I see. So what I worry could happen..?
<nij->
Actually, could the problem also happens for integers (which are nonmutable values)?
<nij->
Integers are immutable indeed, but the slot of X isn't.
<bike>
isetq apparently expands into define-symbol-macro and setq. so it'll depend on what guarantees your implementation makes about the thread safety of those. if any.
<nij->
Wow.. yeah.. actually changing 1000 to 100000 shows the issue!
<nij->
(sb-thread:make-thread (lambda () (loop repeat 100000 do (setf x (1+ x))))) ; do this two times
<bike>
the general rule for unsychronized modifications is "don't"
<nij->
What should I do to guarantee that setting slots is functional?
<bike>
if you mean "functional" as in "functional programming", modifying anything is rather anathema
<bike>
if you mean it as in "works", use atomic operations or wrap accesses in locks
<nij->
So my question becomes: Is there any atomic way to setf?
pranav has quit [Read error: Connection reset by peer]
<bike>
it does not handle general modifications, but does have atomic-incf
<bike>
setf in general is of course far too complicated to make atomic always
<nij->
Hero!
<bike>
heroine, rather, my mistake
<nij->
Hmm.. is this achieved by comparing the value again before "real modification"?
<bike>
that would not be very atomic
<bike>
programming with atomics is very tricky and you have to give up a lot of intuitions
<bike>
if you write something like (when (= variable old-value) (setf variable new-value)) like that, it is possible that the variable's value could change in between the comparison and your write, so the comparison would not help
<nij->
Oh I see.
<nij->
CAS is used when there's no implementation-dependent supports for atomic operations.
<nij->
E.g. sbcl has sb-ext:atomic-push
<nij->
and for #-(or allegro ecl lispworks sbcl) it falls back to using cas.
<nij->
bike Why is the general atomic-setf too complicated to implement?
<nij->
Just wrap CAS all over the place? Can't we?
<bike>
how would you do (setf (subseq x 0 1000) ...) atomically?
tyson2 has quit [Read error: Connection reset by peer]
<bike>
or (setf (foo) x), given (defun (setf foo) (value) (sleep 100) (print +magna-carta+) (setf *value1* value *value2* value *value* value))
<nij->
Use CAS?
<nij->
But then we have to compare recursively.. Is that the problem?
<bike>
what exactly do you think CAS is?
<bike>
to (setf (subseq x 0 1000) ...) you would need to be able to set 1000 elements of a sequence in such a way that no other thread could observe the sequence with more than zero and less than a thousand elements set.
<bike>
"all at once"
<nij->
To cas-setf a place, first make two copies of the value at the place, setf one of them, compare the unmofied one with the place again, if match setf the place to be the modified one.
<bike>
nope
<bike>
CAS is an operation that requires hardware support, generally
<bike>
And your hardware is not prepared to do it to an entire kilobyte
<bike>
cas also does not require copying in any meaningful way.
<nij->
Hmm..
<beach>
nij-: It looks like you need to also read a book on operating systems if you are going to know about synchronization and such.
<nij->
bike From wikipedia "Algorithms built around CAS typically read some key memory location and remember the old value. Based on that old value, they compute some new value. Then they try to swap in the new value using CAS, where the comparison checks for the location still being equal to the old value. If CAS indicates that the attempt has failed, it has to be repeated from the beginning"
akoana has joined #commonlisp
<bike>
i know what CAS is, thank you
<nij->
But.. isn't that what I described?
<bike>
Do you see anything in there about copying? Or about the "key memory location" being an entire kilobyte? or about how you work the SLEEP call in there?
<nij->
Does "memory location" mean the usual memory location?
<beach>
nij-: The CAS instruction typically handles one or at most two words. bike's example was when an entire sub-sequence is affected by SETF.
<bike>
that's also describing "algorithms built around CAS", not the operation of CAS itself
<bike>
a memory location means a memory location. some spot in your RAM
<nij->
Oh.. seems that memory location means the literal one..
<nij->
I was thinking a value slot of a symbol can also be counted in a more general way.
<nij->
No wonder you mentioned this needs hardware support.
<bike>
again, this is an operation the CPU does
<bike>
the CPU does not know anything whatsoever about lisp
<nij->
I see now.
<younder>
for the x86
<beach>
nij-: Symbols may not have value slots.
<nij->
How about value-slot-level-CAS?
<bike>
indeed, with first class global environments, getting the value of a symbol not known at compile time requires two indirections: one to look up the value cell, and one to look into the cell. and the first of those is probably a hash table lookup
<bike>
which is all going to make atomicity difficult-to-impossible
<nij->
Generalize what "memory location" to value slots, and do the same thing. Then we can get an ok-ish atomic-setf.. but we need to be able to recursively copy and compare, which is kinda hard.
<bike>
okay, it's your saying things like "generalize memory location" that make me think you don't know what CAS is and need to slow down
<bike>
we are talking about CPU instructions here. what am i going to do to generalize it? lay down new silicon?
<nij->
Moving to #clschool .. (?)
<younder>
nij don't bother this channel is dead most of the time, let alone clschool. I appreciate the sentiment, but this channel is not all that busy
<nij->
younder - Thanks. But I think it may get a bit off-topic and too easy for many people here.
<younder>
off topic is #lispcafe
<younder>
That still sees plenty of traffic
younder has quit [Remote host closed the connection]
younder has joined #commonlisp
fererrorocher has quit [Quit: WeeChat 4.2.1]
fererrorocher has joined #commonlisp
igemnace has joined #commonlisp
wacki has joined #commonlisp
lucasta has quit [Quit: Leaving]
triffid has joined #commonlisp
triffid has quit [Remote host closed the connection]
triffid has joined #commonlisp
triffid has quit [Client Quit]
triffid has joined #commonlisp
thanosapollo has left #commonlisp [Leaving]
X-Scale has quit [Ping timeout: 250 seconds]
jonatack has joined #commonlisp
ldb has joined #commonlisp
b00p has quit [Quit: b00p]
b00p has joined #commonlisp
ebrasca has joined #commonlisp
occ has joined #commonlisp
igemnace has quit [Read error: Connection reset by peer]
mm007emko has quit [Read error: Connection reset by peer]
wacki has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
b00p has joined #commonlisp
igemnace has quit [Quit: WeeChat 4.2.1]
fererrorocher has quit [Quit: WeeChat 4.2.1]
fererrorocher has joined #commonlisp
thuna` has quit [Changing host]
thuna` has joined #commonlisp
akoana has quit [Quit: leaving]
thuna`` has joined #commonlisp
thuna`` has quit [Quit: Quit]
fererrorocher has quit [Quit: WeeChat 4.2.1]
dustinm` has joined #commonlisp
ldb has quit [Ping timeout: 252 seconds]
zetef has quit [Ping timeout: 272 seconds]
X-Scale has joined #commonlisp
nij- has joined #commonlisp
tedwing has joined #commonlisp
ebrasca has quit [Read error: Connection reset by peer]
wacki has joined #commonlisp
samedi has joined #commonlisp
jamesmartinez has quit [Quit: Connection closed for inactivity]
pranav has joined #commonlisp
nij- has quit [Ping timeout: 268 seconds]
Pixel_Outlaw has joined #commonlisp
dcb has quit [Quit: MSN Messenger]
dcb has joined #commonlisp
fererrorocher has joined #commonlisp
zetef has joined #commonlisp
jonatack has quit [Ping timeout: 264 seconds]
McParen has joined #commonlisp
fererrorocher has quit [Quit: WeeChat 4.2.1]
nerap has joined #commonlisp
cage has quit [Remote host closed the connection]
<nerap>
I'm using the spinneret library I get an error when evaluating the following function (spinneret:with-html-string (:svg :width "35" :height "35" :viewBox "0 0 24 24" :fill "none" :stroke "#fff" :stroke-width "2" :stroke-linecap "butt" :stroke-linejoin "arcs" (:line :x1 "3" :y1 "18" :x2 "21" :y2 "18"))).
<nerap>
The error is: The function :LINE is undefined.
<nerap>
I've fixed the issue I've added :line and :path to spinneret::*html5-elements*.
fererrorocher has joined #commonlisp
nerap has quit [Remote host closed the connection]
bilegeek has joined #commonlisp
Lycurgus has joined #commonlisp
random-jellyfish has joined #commonlisp
<random-jellyfish>
is there a way to unbind initialize-instance for a class?
<random-jellyfish>
I wrote a bad initialize-instance and I don't want to restart the repl
<random-jellyfish>
I just wanna "undo" it somehow
<random-jellyfish>
maybe write an empty one to overwrite the old one?
bilegeek has quit [Quit: Leaving]
<bike>
if you're in slime, it's relatively easy to remove methods interactively
<bike>
do M-x slime-inspect (or , inspect), put in #'initialize-instance, and then hit "remove method" for the victim
<bike>
i imagine there are similar mechanisms in slimv/sly/etc.
<random-jellyfish>
bike, thanks, I ended up restarting the repl but I will save that to my notes for next time, thanks!
b00p has quit [Quit: b00p]
cage has joined #commonlisp
b00p has joined #commonlisp
jonatack has joined #commonlisp
jeosol has joined #commonlisp
bilegeek has joined #commonlisp
prxq has quit [Ping timeout: 255 seconds]
markb1 has quit [Read error: Connection reset by peer]
akoana has joined #commonlisp
cinerion has quit [Quit: WeeChat 4.0.4]
McParen has left #commonlisp [#commonlisp]
akoana has quit [Client Quit]
akoana has joined #commonlisp
markb1 has joined #commonlisp
jon_atack has joined #commonlisp
jonatack has quit [Ping timeout: 255 seconds]
cinerion has joined #commonlisp
Inline has quit [Ping timeout: 268 seconds]
Inline has joined #commonlisp
chomwitt has joined #commonlisp
cage has quit [Quit: rcirc on GNU Emacs 29.2]
jon_atack has quit [Ping timeout: 252 seconds]
akoana has quit [Quit: leaving]
b00p has quit [Quit: b00p]
fererrorocher has quit [Quit: WeeChat 4.2.1]
Lycurgus has quit [Quit: leaving]
amb007 has quit [Ping timeout: 268 seconds]
chiselfuse has quit [Remote host closed the connection]
chiselfuse has joined #commonlisp
amb007 has joined #commonlisp
kevingal has joined #commonlisp
amb007 has quit [Ping timeout: 256 seconds]
borodust has quit [Remote host closed the connection]
wacki has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
random-nick has quit [Remote host closed the connection]
chomwitt has quit [Ping timeout: 256 seconds]
random-nick has joined #commonlisp
nij- has joined #commonlisp
alcor has quit [Ping timeout: 268 seconds]
decweb has quit [Ping timeout: 252 seconds]
son0p has quit [Quit: Leaving]
donleo has quit [Ping timeout: 268 seconds]
borodust has joined #commonlisp
shka has quit [Ping timeout: 264 seconds]
istewart has quit [Quit: Konversation terminated!]
varjag has joined #commonlisp
istewart has joined #commonlisp
pranav has quit [Remote host closed the connection]
reb` has joined #commonlisp
reb` has quit [Remote host closed the connection]
samedi has quit [Remote host closed the connection]
samedi has joined #commonlisp
son0p has joined #commonlisp
b00p has joined #commonlisp
samedi has quit [Remote host closed the connection]
dinomug has joined #commonlisp
reb` has joined #commonlisp
reb has quit [Read error: Connection reset by peer]