freenode/#lisp - IRC Chatlog
Search
1:48:27
no-defun-allowed
The class #<STANDARD-CLASS COMMON-LISP:STANDARD-OBJECT> was specified as a superclass of the class #<STANDARD-NETFARM-CLASS COMMON-LISP:NIL {1002571863}>, but the
1:48:28
no-defun-allowed
metaclasses #<STANDARD-CLASS COMMON-LISP:STANDARD-CLASS> and #<STANDARD-CLASS COMMON-LISP-USER::STANDARD-NETFARM-CLASS> are incompatible. Define a method for SB-MOP:VALIDATE-SUPERCLASS to avoid this error.
1:49:07
Bike
do what it says, define a validate-superclass method. probably oen that always returns t.
1:58:28
no-defun-allowed
one last silly question: is there a way to make function recompilations appear to threads atomically?
1:59:18
no-defun-allowed
so then you wouldn't have a small window of time where threads have updated functions and not updated functions. actually that's probably just bad abstraction.
1:59:42
no-defun-allowed
maybe it's not, but still if you had to replace some kind of backend it'd be best to have it update all in one go
2:03:02
no-defun-allowed
compile some lambdas, interrupt all threads with a thunk that waits on a bt:condition-variable, setf the fdefinitions and notify them when we're done
3:05:21
oni-on-ion
need lisp image sync for true parallel nodes. or, why doesnt lisp have that kind of 'green' thread
3:23:53
beach
It's a portable Common Lisp reader, capable of also "reading" comments and other skipped material and to preserve source location of everything it reads.
3:28:40
beach
pillton: Oh, and I created a #sicl channel where I can freely blab about SICL progress.
3:31:44
beach
The SICL progress is not that spectacular, seen from the outside. But I did find a good solution to the problem with method combinations cited in Didier Verna's paper.
3:33:03
beach
A second (short) article might be "MAKE-METHOD-LAMBDA revisited", because I read Pascal Costanza's article about the subject and it has many errors in it. Plus, I don't think there is a problem with it as his article claims.
3:34:01
beach
A third paper (if I can get this stuff to make fast enough progress) might be describing the SICL bootstrapping procedure.
3:38:34
no-defun-allowed
hey there's three now but there's less chance we'll decide on a common place to host it
3:41:09
oni-on-ion
japan for sure, im always coming across CL stuff in japanese (i can read) and of course reddit.com/r/lisp_ja
3:41:16
beach
pillton: Anyway, that's all the news *I* can think of right now. I am sure there is more that I am not following that closely, or that I forgot about.
3:42:25
beach
pillton: Oh, I don't know whether you know him, but Jim Newton is defending his PhD in Paris on November 20th. It's all about Common Lisp, and I am on the committee.
4:04:05
no-defun-allowed
come to think of it, i don't think you've stuck around to witness the trams at their finest, beach
4:04:11
no-defun-allowed
if you're lucky the trams will stop and you'll have to wait two hours for one, hah
4:09:50
loke
Because the boodness of the loication is inversely proportional to the travel distance from me.
4:28:27
oni-on-ion
someone was asking recently, if there is documentation tools for CL, but got the answer no? there is CCLDoc that works on SBCL
4:38:52
oni-on-ion
i think someone was asking if there is a way to collect docstrings of a CL package
4:39:48
beach
oni-on-ion: That is one of the worst definitions of "documentation tool" that I can think of.
4:42:10
beach
oni-on-ion: Collecting docstrings and turning them into something called "documentation" very frequently results in crapppy such "documentation".
4:42:21
LdBeth
https://www.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/lisp/code/tools/user_man/0.html
4:42:54
oni-on-ion
beach: you could have said that directly? i did not mean to suggest a definition for "documentation tool"
4:44:40
Elronnd
is there any way to pass my lexical scope into a function, without making it into a macro?
4:45:32
beach
Elronnd: If that were possible, Common Lisp would be a "slow language" in that it would be impossible to write an optimizing compiler for it.
4:47:18
oni-on-ion
i am not sure what the point of saying "No" or "Impossible", especially with CL? of course people writing compilers and languages *in* CL that *do* have such a feature. ?!
4:47:58
Elronnd
I'm making an html templating thingy, and one of the features I added is variable interpolation so I can say '(span (@ *myvar*)). However that only works if *myvar* is global
4:48:44
oni-on-ion
Elronnd: check out ParenScript, ive used it a bunch, it does some of those things.
4:49:39
russellw
That sounds like an unhygienic macro would do the job? Transform the expression into something involving the local variable names and let the compiler take it from there?
4:49:49
oni-on-ion
i am not suggesting to use parenscript, but to check it out. notice the difference. it has its own "environment handling" suchness
4:50:22
Elronnd
russellw: I would have to make the macro construct a bunch of conses and appends, and I'm not 100% sure how to do it
4:50:23
oni-on-ion
and is similar enough in context of web i figured it would be relatable. trying to help +)
4:51:20
aeth
Elronnd: What you should probably do is have your macro ultimately build up this: (lambda (my-var) (format stream "<html>....%A ...</html>" my-var))
4:51:50
aeth
Elronnd: So build a format string, and put %A or similar things where you want to have the substitution to happen
4:52:16
aeth
Then run the format string through format, optionally wrapping it in a lambda so you have an object
4:53:54
beach
Elronnd: Suppose I could do something like this: (let ((x (+ a b))) (f x) (sin x)) and this (defun f (x) <modify x>). Then the compiler could not use type inference to determine that X is a number when SIN is called. Then SIN would have to check that it really is a number.
4:53:56
aeth
Elronnd: I recommend with-output-to-string rather than concatenating a bunch of strings directly. Then you can basically just print into that string to built up your format string
4:54:35
beach
Elronnd: The creators of Common Lisp wanted to avoid such flexibility so that it would be possible to optimize this code at compile time.
4:54:47
Elronnd
aeth: problem with that is, it's unclear that the web lib I'm using allows for that. I think it wants me to just return a string
4:56:18
Elronnd
beach: I meant it more as a special form, not the default way of calling functions. So if instead of (f x) I said [f x], then f would get to modify my copy of x, but if I just say (f x) then it works as it already does
4:56:30
aeth
Elronnd: something like this: (funcall (lambda (user) (format t (with-output-to-string (output) (write-line "<html>" output) (write-line "<body>" output) (write-line "Hello, ~A!" output) (write-line "</body>" output) (write-line "</html>" output)) user)) "world")
4:57:22
aeth
Elronnd: You can just replace t with an arbitrary stream, or nil if you want a string, or you could get rid of the outer formatted output entirely and just directly interpolate the variables in pieces of it if you wanted to optimize it.
4:58:21
aeth
e.g. (funcall (lambda (user) (with-output-to-string (output) (write-line "<html>" output) (write-line "<body>" output) (format output "Hello, ~A!" user) (write-line "</body>" output) (write-line "</html>" output))) "world")
4:59:02
aeth
(The funcall lambda thing might sound weird, but your macro is generating just up to the lambda part... alternatively, a defun if you want it named)
5:00:01
Elronnd
that seems more difficult to construct again. I had been using the call stack to generate closing tags, so (to simplify it) (format nil "<~A>~A</~A>" tag (parse-childs) tag)
5:01:05
aeth
Elronnd: Your macro could generate one pair at a time, recursively (with a helper function). Of course, this isn't Scheme so even tail recursion might blow the stack, but it probably won't for something this small.
5:01:47
Elronnd
oni-on-ion: I haven't, might just use that. Form is a bit different than I'd like, but eh
5:02:03
aeth
Elronnd: You don't have to balance anything complicated because you're using streams with this approach, so you just need to make sure that the macros generate the calls to the stream writing functions so that they get called at the right time.
5:02:53
aeth
Actually, the latter approach with the inner format probably wouldn't work as well as the earlier outer format one I posted, because you can make the entire format string at compile time.
5:02:54
Elronnd
wait, why can tail recursion blow the stack? Doesn't it mean that any additional tail calls consume no stack?
5:04:32
aeth
Elronnd: Tail recursion isn't guaranteed to be optimized in CL, unlike in Scheme. It could be, but it probably not at (optimize (debug 3))
5:06:45
aeth
Anyway, what I would do is generate this format string at compile time in a macro (note that if you don't use format you can use ~A and if you do you have to escape it with ~~A): (with-output-to-string (output) (write-line "<html>" output) (write-line "<body>" output) (write-line "Hello, ~A!" output) (write-line "</body>" output) (write-line "</html>" output))
5:07:21
aeth
If you generate each pair at the same time and then work on the middle, you can keep the tags balanced
5:07:35
Inline
only to the extent of adding to it for new stuff (all the stuff that has to be pushed there anyway), not for pushing the same stuff over and over
5:08:25
Inline
instead of pushing the same stuff over and over it reserves only one stack entry and reuses that over and over
5:09:08
jasom
oni-on-ion: tail calls reuse the stack frame; for the specific case of a self-call that means zero extra space; it might use *less* space if the tail call is to a function with a smaller stack frame.
5:09:47
aeth
loke: looks like this is finally a use for formatter, since the pattern to generate with the macro is (lambda (...) (format ...))
5:10:19
oni-on-ion
jasom: ah, right ^_^ was a bit confused where it was said to grow and also stay the same.
5:11:01
ealfonso
I asked this ealier but I was disconnected. Is it a bad idea to have export declarations per-file via the export function, as opposed to within a defpackage form? I heard something was being deprecated?
5:11:23
Inline
and the frame size change may be due to the recursion step doing two different branches tail wise
5:11:48
loke
ealfonso: In such cases, I'd recommend you put the DEFPACKAGE form in the head of the file, and include an :EXPORTS section in the DEFPACKAGE.
5:12:14
aeth
Elronnd: So your macro could look something like this: (defmacro generate-the-html (...) `(formatter ,(with-output-to-string (output) ...)))
5:12:42
aeth
Then you just need to write to the stream in the right order, doing what you can at macro time and saving the rest for the format string
5:12:43
jasom
ealfonso: not being in the defpackage may cause issues if you have to recompile the defpackage form.
5:13:08
loke
Having it in defpackage is also useful when using SLIME, as it can manage it automatically for you.
5:13:15
ealfonso
jasom yes, I think this is what I am finding. I will just put everything in defpackage
5:13:28
loke
ealfonso: Then I suggest you put it in a separate files (most systems seems to use package.lisp)
5:13:59
loke
ealfonso: But keep the exports in the defpackage, as otherwise SLIEM will get confused, and recompiling will cause problems, sometimes.
5:14:32
loke
Inline: you have to separate what CL says, vs. what implementations do. The CL spec never discusses the concept of the heap.
5:15:22
loke
Inline: A CL implementation is free to implement the spec in any way they want, as long as it does what the spec says.
5:16:46
jasom
Inline: for a typical C implementation automatic storage means stack, and malloc() means heap.
5:18:05
jasom
but the C standard doesn't mention stack or heap either, so that's still just implementations
5:18:52
aeth
The CL standard mentions the stack, in dynamic-extent. http://www.lispworks.com/documentation/HyperSpec/Body/d_dynami.htm
5:21:41
jasom
in general stack is increment pointer to allocate, decrement pointer to free, and heap the allocation and free need not happen in any specific order.
5:24:04
jasom
Inline: endian has nothing to do with it; it's a question of whether you increment to allocate or decrement to allocate
5:25:24
jasom
the ABI defines things like whether stack grows up or down and how parameters are passed. Certain ISAs lend themselves to stack growing up or down because they have e.g. a "call" instruction or push/pop instructions.
5:31:06
russellw
I'm trying to send all console output to log file, using a broadcast stream. This mostly works. *standard-output* gets stuff I print myself, *trace-output* gets output of TIME, *error-output* gets most error messages. But when SBCL runs out of memory, it prints a table of garbage collection info that does not get captured. How can I capture that?
5:37:20
russellw
jasom, that is the page I was looking at, I've covered every output stream. What am I missing? Do I also need to somehow cover the bidirectional ones?
5:41:41
jackdaniel
russellw: did you consider using log4cl? it has a concept of appenders and log levels
5:42:50
russellw
jackdaniel, not necessary, thank you, I already have the log running fine. The issue is how to make all the system code output to my log
5:43:58
russellw
Inline, to my pleasant surprise, assigning an output stream to query-io and debug-io, works – it does not crash the program or anything. But unfortunately it does not capture the GC error output
5:49:57
jasom
russellw: the GC error output is almost certainly not written in lisp and probably uses file streams
5:50:45
Inline
(defun gc-logfile () "Return the pathname used to log garbage collections. Can be SETF.
5:50:45
Inline
designated file is opened before and after each collection, and generation statistics are appended to it."....
5:53:30
Inline
(!defvar *after-gc-hooks* nil "Called after each garbage collection, except for garbage collections
5:53:30
Inline
triggered during thread exits. In a multithreaded environment these hooks may run in any thread.")
6:10:47
another-user
i tried to use this reader macro https://gist.github.com/rmoritz/1044553/b2d2d8e4b933cb0f6c3fb5ff3f9bcfae6be7ce47 and it works in sbcl repl
7:00:23
LdBeth
And these reader macros are not idiomatic, bacause (quote [1 2 3]) is supposed to return #(1 2 3)
7:53:30
another-user
shka_: do you mean instead of {} macro i should create #{} kind of macro? but how?
7:56:42
another-user
shka_: i need this https://gist.github.com/rmoritz/1044553/b2d2d8e4b933cb0f6c3fb5ff3f9bcfae6be7ce47 to work in slime repl
7:58:36
kristof
this is so minor but those lambdas don't have to be indented so far; only two spaces after set-macro-character
8:00:05
kristof
Also, and this is my limited experience, but I've never really wanted hash literals. Hash tables have advantages for multitudinous collections
8:00:27
jdz
Also, pretty sure READ-DELIMITED-LIST can be used instead of creating new readtables on every invocation.
8:00:29
kristof
But for small collections, which is what I'd what literals for, plists outperform the hashing overhead, usually
8:02:14
jdz
another-user: if the calls to SET-MACRO-CHARACTER are done in the REPL then they should be working.
8:11:51
jdz
another-user: I re-wrote the square bracket reader: https://gist.github.com/jdz/89b93653da3c3fe965a904b67cec5e43
9:35:10
svillemot
Myon: I've investigated your pgloader issue, and the problem comes from cl-ironclad which is out-of-date in Debian
9:37:28
dim
svillemot: I've been told (here) that the compile time difficulties are also solved with the most recent version of SBCL
9:39:29
svillemot
actually it's *because* SBCL is recent that we have problems with nibbles and now ironclad, because those project use SBCL internals, and needs updating
9:40:42
dim
while you're around, would it be a good idea that I spend time trying alternatives to cl+ssl/openssl for pgloader, maybe using bearssl or wolfssl or some other lib that would make our life easier?
9:42:30
svillemot
the cl+ssl situation is now ok on the Debian side, but only because I patched it for OpenSSL 1.1
9:43:05
svillemot
diverging from upstream is not ideal, so if there are other projects which have native support for OpenSSL 1.1, that could be interesting
9:43:24
dim
my limited understanding of the problems is that openssl itself plays tricks with the way it exports symbols, other ssl libs might be clean on that aspect
9:45:14
svillemot
wolfssl seems promising and is packaged; that does not seem to be the case for bearssl
9:46:30
dim
otherwise there's always https://github.com/shrdlu68/cl-tls/ but well I'm worried about using non well tested implementations of should-be-secure stuff
10:00:06
dim
I can find https://github.com/mak08/PolarCL which depends on cl-mbedtls... but for now I can't that that system
11:11:26
Xach
I wish all implementations provided and maintained good ways to make secure connections on every platform they support.
11:38:41
jcowan
Proper tail recursion does not require constant stack, only asymptotically constant stack.
11:40:37
jcowan
Specifically, the implementation must support an unbounded number of active tail calls. How it does that, as always, can vary.
11:42:57
beach
ggole: Can you elaborate? I mean, if they are not reused, the heap will be exhausted rather than the stack.
12:55:41
jmercouris
let's say I have path like #P"/Users/username/file.txt", how can I get "file.txt"?
12:56:04
jmercouris
I was thinking of uiop:unix-namestring and then doing some string parsing, but I figured there must be a better way