libera/#commonlisp - IRC Chatlog
Search
8:38:42
chomwitt
Hi. I hope my question is not irrelevant. I try StumpWM and i noticed that debian package has the lisp files included and so a package for ALL architectures. But arch has only a amd64 package with a binary and none lisp files.
8:45:36
Nilby
chomwitt: sbcl can save an exectutable that contains itself and all the loaded/compiled code that acts as relatively normal program.
8:54:23
chomwitt
i havent test it in arch. In my devuan system i noticed that when running stumpwm and seeing it's version it reported 'ver 1.0.1 compiled in 5 Feb 2024'. That issue prompted my little quest because the version in the package was supposedly 22.11-3
8:54:44
chomwitt
and in debian the executable is a script with : sbcl --load "/usr/lib/stumpwm/load.lisp"
8:55:19
chomwitt
so being a clisp newbie that command seems to me like feeding code to an intepreter..
8:56:06
beach
Yes, it sounds like Debian is compiling from source and using an installed SBCL, whereas arch is distributing a binary containing everything.
8:58:00
beach
But it is likely that the Debian version is compiling some things at startup. Possibly just the load.lisp file.
9:00:45
Nilby
beach: I'm sorry to be a "well actually" guy, but sbcl does use an interpreter for throw away forms since it's faster.
9:03:23
beach
Nilby: If I do (defun f (x) x) at the REPL, and then (compiled-function-p #'f) I get T.
9:06:45
Nilby
but if you just have like (+ 2 3) in file, it doesn't need to save it, and it's quicker not to compile it
9:09:37
Nilby
i've read through it, but i don't remember it very well. it's called sb-fasteval, i think written by doug katzman a while back.
9:10:29
Nilby
maybe it's only used when building sbcl itself, since i don't see sb-fasteval in my *features*
9:18:51
Nilby
i guess it's designed to speed up macro expansion but maybe not turned on in the build anymore
11:44:14
_death
may be worth the trouble if you have something calling EVAL repeatedly with simple forms
11:58:47
dnhester26
I would like to add an option to a slot, does anyone know how to do this? E.g. like :initargs, I want something called :has-many that can accept a T value
11:58:50
dnhester26
http://metamodular.com/CLOS-MOP/initialization-of-slot-definition-metaobjects.html
11:59:18
dnhester26
That's the MOP doc that probably referes to what I'm talking about, but from there I don't really know what to do to do it
12:08:07
dnhester26
I started adding the MOP docs to the Technical Reference so that we can add examples as well given how hard it is to find them https://lisp-docs.github.io/cl-language-reference/meta-object-protocol/chap-6/6-1-sections#615-initialization-of-slot-definition-metaobjects
12:14:32
_death
dnhester26: here's an old snippet that allows having a :history-max-depth option in slot specifiers https://gist.github.com/death/c4996d3a39559fb69d0f2c92f56e2bb5
12:14:56
_death
dnhester26: another approach would be to avoid MOP and have your own defclass-like macro
12:24:01
dnhester26
ah, thanks, I just saw somewhere in chapter 3 they explain it, but only chapters 5 and 6 are available easily online
12:40:03
Shinmera
New release: https://shinmera.github.io/cl-gog-galaxy/ Support my continued work on Patreon: https://patreon.com/shinmera
12:47:14
dnhester26
_beach: thanks I can now create the slot, how can I then access it from the class? I can do inspect on (inspect (find-class 'foo)) and see it's there, but how can I access it from the code?
15:15:39
kevingal
usocket question: is there a way to configure a TCP socket so that calling READ-SEQUENCE on the socket stream reads in as many bytes as are available and then returns?
15:16:13
kevingal
Right now, it's reading in a couple of bytes and then hanging because the buffer isn't full and there are no more bytes.
15:23:11
kevingal
Hm, do I need to read the bytes one at a time and keep checking usocket:socket-state, then?
15:23:17
gilberth
And that would make READ-SEQUENCE not behave as specified by ANSI-CL. Your only chance is to to loop with using READ-CHAR-NO-HANG. READ-BYTE and LISTEN won't work in case of EOF (the connection being closed by the peer) because LISTEN would return NIL in that case.
15:25:06
gilberth
I have no clue what SOCKET-STATE is. The proper API is LISTEN and as this is broken by specification READ-CHAR-NO-HANG.
15:26:52
gilberth
I was working on a proposal to add an option to READ-SEQUENCE for UNIX behavior and/or better buffer access, but never managed to finish that.
15:27:52
gilberth
As ANSI-CL is specified it's not possible to write fast TCP/IP servers and you can't do at all when you want to read octets.
15:30:43
dnhester26
can anyone help? https://stackoverflow.com/questions/77942085/slot-definition-disappearing-when-using-two-metaclasses
15:31:55
younder
Just read sbcl/src/interpreter. As for fasteval it needs to be compiled in and SB-EXT:*EVALUATOR-MODE* needs to be :interpret. By default the variable isn't set, so evaluation isn't used.
15:33:43
younder
It was news to me as well. Just like that arena collector. SBCL just keeps throwing surprises at me :)
15:41:13
beach
dnhester26: You probably need to define your methods specialized to oql-metaclass rather than to has-many-meta-class. Otherwise, it is not clear which method on direct/effective-slot-definition-class is going to be applicable. Yours or that of MITO.
15:42:02
beach
dnhester26: Also, DEFMETHOD is a standard operator. There is no need to supply a CLOSER-MOP package prefix for it.
15:49:40
beach
dnhester26: Oh, and MITO probably does the same thing that you do, which is to define its own direct/effective-slot-definition. So you probably need to define classes for those that have your slot-definition classes and those of MITO as superclasses, and have direct/effective-slot-definition-class return those class metaobjects.