freenode/#lisp - IRC Chatlog
Search
2:16:15
nij
Hello #lisp! I'm trying to understand how CL extension got bootstrapped. One specific example I'm looking at is sbcl's timer. In CLHS, there's no timer; while in sbcl, there's timer. However, sbcl bootstraps itself.. but the support for timer must come somewhere. After digging into the repo, it seems that the magic is #'alien-funcall. However, I fail to dig more into it. Could someone explain or provide some hint - how are extension
2:17:38
Bike
it's not really a matter of bootstrapping. alien-funcall is an extension to call C ABI functions.
2:17:51
Bike
https://sbcl.sourceforge.io/manual/index.html#The-alien_002dfuncall-Primitive described here
2:20:23
no-defun-allowed
SBCL doesn't use timers as part of bootstrapping, so it's perfectly reasonable.
2:21:07
no-defun-allowed
Yes, once there is an SBCL compiler running, it can generate the code to ALIEN-FUNCALL.
2:24:53
nij
Hmm.. just found out that bd threads on sbcl are just some alias of sb threads.. why should i use bd-threads then? For portability?
2:25:20
nij
If it's for portability, I still have to worry if bd thread is correctly implemented over other implementations..
2:26:21
no-defun-allowed
Yes, Bordeaux-threads should be used for portability, and it is implemented correctly for any implementation I have used.
2:28:06
no-defun-allowed
If you want to argue that, the threading implementation in SBCL could be broken too. And then you'd have to fix up all your code to work on another implementation.
2:28:06
nij
I should only say that it's tested and designed for sbcl.. it might behave unexpectedly for other impls.
2:30:48
nij
Is there any system-level timer abstraction? For sbcl we have its timer.. but while sb-threads are abstracted by bd-threads, sb-timers do not seem to be.
2:31:28
no-defun-allowed
Of course SB-THREAD would only work on SBCL, but (as I understand it) the Bordeaux thread protocol is derived from B.2 and B.3 of the CLIM specification (Multi-processing and Locks respectively).
2:32:26
nij
Bike, does trivial-timer call system timer? Or it's an abstraction over bd-threads? Based on its dependency, I don't see how it calls system timers.
2:32:37
no-defun-allowed
I recall that handled ERROR strangely on Clozure, because it would fall back to creating a new thread which has none of the condition handlers set up.
2:35:59
no-defun-allowed
nij: It uses SBCL's timers on SBCL, but falls back to a portable thread implementation.
2:36:38
nij
Hmm.. for common lisp to "grow", we cannot alter the standard (ie those described by CLHS). Instead, we should implement them in new implementations. But then after a period of time, someone should come out and unify them, like bd-threads for threads.. right?
2:37:25
nij
no-defun-allowed: If trivial-timer is portable, then what timers does it call on other implementations?
2:39:02
nij
Oh.. so on sbcl it's sbcl's.. but on other implementations it abstracts over threads to make a timer.
2:44:36
nij
Hmm.. suppose I have a function (lambda () ...), how do I call it with all outputs redirected to some file?
2:46:42
no-defun-allowed
(with-open-file (*standard-output* pathname :direction :output ...) (funcall function))
2:58:42
Bike
of course if you output to some other stream that won't be redirected, but *standard-output* is the default output stream
3:23:55
muyinliu_
cl-disruptor, a high performance inter-thread messaging library, a port of LMAX Disruptor in Common Lisp, https://github.com/muyinliu/cl-disruptor
6:10:21
beach
Today I'll try to figure out whether the problems with my sound have to do with the microphone or with OBS.
6:57:41
beach
phoe: There is nothing wrong with my microphone. I just used Audacity to record my voice and the sound is quite good. So the problem is with OBS then.
7:01:00
easye
Morning all. Is there a pure ANSI CL library someone might recommend to convert JSON to YAML?
7:22:03
easye
MichaelRaskin: moments ago I just learned this from p_l Still digesting the various libraries.
7:22:34
easye
My ultimate need is a JSON Schema validator in pure ANSI that works well for recursively defined schemas.
7:25:13
easye
What I mean by ANSI CL is sort of a shorthand for saying "portable across contemporary ANSI CL implementations)
7:25:38
easye
Lycurgus: the full twitch stream is available, for which you have to seek to the right spot.
7:26:04
easye
The ad-hoc ELS tech crew will be editing it into bite-sized YouTube chunks as time permits.
8:07:55
asarch
How would you remove entirely a SBCL that has been compiled/installed using the tarball from the project site?
9:57:23
Shinmera
Our first Lisp game is now available for purchase on Steam! https://store.steampowered.com/app/1605720/Eternia_Pet_Whisperer/?beta=0
10:13:54
nij
Hello! I hope to launch a thread that should run indefinitely. It doesn't seem that there would be an unhandled case. But no one can be 100% on this, I think. So, what should I do for it to move on if it happens to have any conditions, and log every thing in the same time?
10:15:07
phoe
(loop (tagbody :continue (handler-bind ((error (lambda (c) (log-error c) (go :continue))) (do-thing)))
10:18:52
flip214
wouldn't be a problem with tail calls... lifetime of the universe will stop most things eventually
10:23:52
nij
The point is that I want them to run indefinitely, without my paying attention to it constantly.
10:25:11
phoe
if a condition is passed to the ERROR function, which does SIGNAL and then INVOKE-DEBUGGER
10:25:21
nij
Uh.. I must misunderstand something. Aren't errors in CL yet another condition, which is some object people can create?
10:26:28
phoe
unless someone does silly stuff like calling SIGNAL with an error condition that should not proceed with execution
10:27:11
phoe
so: yes, only unhandled errors can cause the thread to enter the debugger unless the code explicitly does something extraordinary
10:27:58
nij
Maybe this is what I want - I want to suppress all debuggers and just let it logged. Is that possible?
10:29:26
nij
However, when a debugger is supposed to be on, usually it will present a list of options. Which option should I let my thread choose automatically in order to proceed?
10:31:40
phoe
if you tell your *debugger-hook* to perform a jump then you'll never enter the proper debugger
10:33:03
nij
Before doing that, I just want to make sure it's not obviously done yet.. as I think it should be there already..
10:33:38
nij
So a service is just a wrapped function, which will be fired as a thread. But after it's fired, it must log every output to some file, and does the error handling stuff I say above.
10:41:47
nij
Is there a "safe" thread, meaning a thread that completely logs all output, and skip (but log) any errors when it's running?
10:43:22
nij
By a "safe" thread I mean a thread that does (1) all logging (2) all things I asked above automatically.
10:45:32
nij
This ==> (loop (tagbody :continue (handler-bind ((error (lambda (c) (log-error c) (go :continue))) (do-thing)))
10:49:00
phoe
there's a variant of handler-case that I described in one of the TCLCS appendices that executes the handler and only then unwinds, but it's not standard
12:28:44
beach
jnewton: Here is the link to the document about a Lisp OS that I mentioned on the phone: http://metamodular.com/closos.pdf
12:48:10
pjb
nij: if log error doesn't use implementation specific API to collect and report the backtrace, then you can use handler-case instead of handler-bind. (loop (handler-case (do-thing) ((error (c) (log-error c)))))