libera/#commonlisp - IRC Chatlog
Search
18:17:03
Guest74
interesting max threads is determined by real memory, max threads per process by virtual memory on linux.
18:17:20
Bike
we can just have a separate thread object that keeps whatever info we want that we garbage collect normally
18:18:16
jackdaniel
yes, I didn't check on other implementaitons, but I have never actually thought that implementation might leave some linger resources when not joined
18:19:35
Catie
The SBCL thread struct has a result slot, which indicates to me that the thread is joined by the runtime somehow and the result is collected, and that calling the sb-thread join function just returns that value
18:19:55
jackdaniel
otoh I think that I remember that sbcl doesn't care for closing streams taht are garbage collected (and such leak may end with no more descriptors)
18:22:37
jackdaniel
you could have copied the file descriptor by using some internals, closing it on gc may give strange results (but well, you've copied it by using some internals :)
18:27:26
Catie
Okay, so working backwards a bit, SBCL has a global variable *joinable-threads* and a function join-pthread-joinables. When I run a thread and let it exit, it resides in *joinable-threads*. When I trigger a garbage collection, the thread is no longer in *joinable-threads*. So maybe SBCL does the convenient thing?
18:35:44
Catie
Ah, sure enough! I missed it because pauseless-threadstart isn't in my *features* anymore, so I skipped right over it
18:36:35
frgo
Oh-kay - I just booked my flights to Porto to ELS2022. Hope to see many of you there ...
18:40:55
frgo
In my day job I work for the German Red Cross. I hope, really hope, that Omicron is covered with the current vaccines. Having all red flags on ICU bed availability in a 100 km radius around Stuttgart is no fun.
18:44:45
pdietz
From what I hear, if you have the mRNA vaccine doses and the booster they're pretty effective against omicron.
18:45:53
jackdaniel
even if you have superman immune system and there is no kryptonite around, when borders are closed then they are closed
18:46:04
pdietz
It's looking nasty in South Africa. In particular it looks much worse than previous variants for children under 2.
18:46:28
frgo
That's what we see - so far (it's too early to tell really). And that's why we don't mind to booster a few weeks before the 6 months period.
19:06:46
random-nick
am I missing something or does CFFI not have a builtin type for fixed-size arrays?
19:27:53
attila_lendvai
ACTION is annoyed by the covid discussion, especially when people echo what they say on TV, as opposed to first-hand experience/info
19:46:02
_73
from the SBCL repl, what is the way I can unqualify a library function? For example I would like to be able to use the symbol `alexandria:compose` as just `compose`. I can do this fine in a package using defpackages `:import-from`.
19:55:34
Alfr
_73, or to make your repl habits less implementation dependent, because implementations make symbols accessible in cl-user which are not in cl.
19:59:29
Catie
Guest74: My understanding is that cffi:foreign-array-to-lisp copies elements from the pointer you hand it
20:02:05
Catie
That would be really nice, I agree. I don't know of anything in CFFI that can do that, but I have no idea about any other FFI packages
20:02:07
Guest74
though WAAF looks interesting. copying isn't so bad, it's basically doublebuffering. But direct access would be nice.
20:12:23
yitzi
Well, with mem-aref you can read the individual elements directly. https://common-lisp.net/project/cffi/manual/cffi-manual.html#mem_002dref
20:12:45
Guest74
I may be wrong, but I assume writing individual bytes to 'foreign memory' would be slower than just copying.
20:23:13
Bike
that's probably not possible, because lisp arrays usually have header data that wouldn't be in foreign controlled memory.
20:30:28
random-nick
Guest74: mem-aref seems to have a compiler macro which eventually directly calls SBCL's function for accessing memory when the type is constant
20:34:34
_death
the limitations are not inherent, the interface was just sufficient to what I wanted at the time so I didn't bother removing them.. but if the idea makes sense, then one could imagine more powerful mmapped array facility.. say for IPC
20:43:33
random-nick
hmm, why does WITH-ACCESSORS not have the simple variant of slot-entry like WITH-SLOTS does?
20:46:28
random-nick
was the accessor naming style where you don't use a prefix not popular when the standard was written?
20:50:57
Catie
What's the vibe on generics nowadays, have they come around? Or are they still a bit frowned upon?
20:54:45
pdietz
The short name style is nicer with package local nicknames, as you can avoid name collision and use the PLN as the prefix.
20:59:04
Shinmera
I don't know who ever frowned upon generic functions, but whoever it was they were probably making a bad judgement call.
20:59:05
Catie
Generic functions, in particular slot accessors without the class name prefixed to them
21:03:43
hayley
Everyone who first learns CLOS apparently thinks they really need a reader macro for SLOT-VALUE. Then, hopefully they learn CLOS.
21:05:30
jackdaniel
novices don't use clos because they don't understand it, experts don't use clos because they do - or something like that
21:06:04
jackdaniel
(in truth most cl programmers use generic functions and clos protocols some way or another)
21:06:51
yitzi
How about: Novices see objects and slots, experts see generic functions and accessors?
21:16:14
rotateq
pve: I'll take that risk. :) first I shall master the state of being a sorcerers apprentice to the next step
21:17:20
jackdaniel
slot-definition-location is advertised by amop authors as a way to optimize important bits implemented with standard classes (to avoid unnecessary function calls)
21:19:06
jackdaniel
they say that to hack something interesting you either need experience, talent or patience. I'm in the last group. thanks though!
21:19:32
rotateq
pve: there's a nice quote starting "if programming languages were like religions, LISP would be like Buddhism". I think that is one of the timeless points which attract me so much.
21:29:15
pdietz
Generic functions for slot access can be nice because you can combine other methods with them. :around, :before, :after
21:33:11
rotateq
in the beginning of the week i realized a bit more how/when the other method-combinations could be effectively used or that it can be useful the when having SETFs also generic the dispatch can go to the new-value too if needed
21:44:56
NotThatRPG
Allegro offers `EXCL:RECORD-SOURCE-FILE` so that one can record where new kinds of things are defined. E.g., I am making FIVEAM do (excl:record-source-file ',name :fiveam-test) inside fiveam:def-test. Question: do CCL and SBCL have any equivalent of this?
21:53:39
Shinmera
Not sure, but that reminds me it would be great if someone added more backends to https://github.com/shinmera/defititions
22:14:18
NotThatRPG
Shinmera: If this supported Allegro, too, I'd be more excited -- Allegro, SBCL, and CCL are my target implementations....
22:26:50
NotThatRPG
Shinmera: I'm already contributing quite enough to CL open source! I'm tapped out...
22:30:00
NotThatRPG
I would have thought there would be an interface to SBCL's source recording but... apparently not?
22:32:34
Shinmera
That reminds me that I initially created https://portability.cl in the faint hopes it would drive people to try and improve the situation on either library or implementation sides, but as far as I can tell it actually changed nothing at all.
22:33:33
Shinmera
So far my impression writing several of these libraries is that unless you do the painful work of aggregating the info for 90% of the implementations out there that you don't even use, nobody'll bother contributing a backend for even one more.
22:35:56
Shinmera
Yeah Clasp has been an outlier. You folks have been doing a tremendous job increasing support coverage.
22:36:24
NotThatRPG
Shinmera: If you look into the crawling horror that is the ASDF source, you will see what it takes... I don't know that anyone besides Fare has the energy to fight through testing on all the various implementations out there.
22:36:59
Shinmera
NotThatRPG: I have, and as I said I've also written many of these libraries myself.
22:38:29
Bike
a lot of these aren't actually that bad assuming the implementation has support. trivial-extensible-sequences support on sbcl consists of #+sbcl #:sb-sequence for example
22:38:54
Bike
but in that case there's a well defined protocol people pretty much go with, which is not the case with e.g. all the compile-file extensions asdf tries to herd
22:39:24
NotThatRPG
Krystof: Does that let me set the source location myself? I will look again -- I was apropos-ing with source-file, so wouldn't have found any source-location symbols.
22:43:34
Krystof
the pattern we use is something like (defmacro deffoo (...) `(%deffoo ... (source-location))) (defun %deffoo (... source-location) <store source-location wherever you like> ...)
22:43:50
Krystof
then whatever consumes your source locations needs to know where you've stored them; I don't think we have a protocol for that
22:45:16
NotThatRPG
Ah. So one *calls* source location, and it gives you back the source location to do with what you will.
22:54:49
NotThatRPG_
I didn't mean to imply that it's more awful than it needed to be. But awful it did need to be.
22:56:29
Fare
The awfulest parts are those that deal with portability across 17 implementations, in UIOP. Especially the portable run-program facility.
22:58:43
Fare
pathnames are a mindfuck, though. There is a wide gap between that the standard specifies and what is common practice in today's world.
22:59:04
Fare
with plenty of undefined behavior that every implementation does in subtly different ways.
23:00:41
Shinmera
I have often thought about starting a thing for a secondary path mechanism that's more tailored towards modern systems, and adding support for that to implementations, but doing so is too much effort even for me.
23:02:25
Fare
but then you have to hook it up into LOAD and all other primitives that deal with paths.
23:02:33
Shinmera
did it? My idea would have been to allow using cl:open/etc with this new path type.
23:05:08
Fare
Also, anything that binds wrapped low-level resources to high-level variables introduces "interesting" issues to make your program async-safe. No one tries to do that because it's too hard (except for the Erlang guys maybe), but I wonder what an async-safe lisp would look like.
23:06:06
Shinmera
I'd give a lot to have the kinds of convenience that exists in JS and C# with the async keyword.
23:08:18
Fare
(well, I use Gerbil on top of Gambit, but it inherits Gambit's relatively good async behavior)
23:08:39
etimmons
One of these days I want to add environment variable support to run/launch-program. Gonna probably take a while to get it right, though
23:09:43
Fare
etimmons, even more "interesting" to get right portably. You may have to punt on many implementations and/or extend them properly.
23:10:06
rotateq
and how do C# and JS do the async stuff? a friend told me in Rust the async is with some kind of continuations, but idk
23:14:43
Shinmera
rotateq: marking a function async causes its return value to be a kinda closure. The await keyword within an async function marks a continuation/closure chain point. So async foo(){ x = await bar(); } returns a closure that should be called when bar() completes. when invoked, the function then resumes, binding x to the result of bar().
23:15:11
etimmons
Fare: by the way, I don't know how much you've checked out of gitlab emails, but I opened a merge request on reader-interception yesterday
23:15:25
Shinmera
rotateq: This makes async programming 1000x less painful because you can essentially pretend it's still imperative in most cases.
23:15:47
Shinmera
You could potentially do something like this in CL but it would definitely require code walking, and yikes.
23:19:12
random-nick
Shinmera: I think you can do something like that with cl-async and green-threads
23:20:06
random-nick
rotateq: scheme's spec requires call/cc, which means that most implementations support it and/or some saner alternative
23:20:57
hayley
And then you have a whole lot of synchronous CL code to deal with, so you won't get very far with async colouring.
23:21:02
random-nick
I think you can implement coroutines using sleeping OS threads, but that is not exactly resource efficient
23:34:39
mzan
hi, I'm blocked on this "problem". I'm not able to optimize CL code using series. It is not converted to normal loops, and it uses all the RAM. This is an example https://0bin.net/paste/n7fhjDxt#7SLnyit7-VDat6Ae5okgznwv5p1vbRmzqVylJWqK8+1
23:41:17
mzan
Shinmera: I don't know if this can help, because I'm a newbie, but there were this interesting discussion about asyncs https://news.ycombinator.com/item?id=29016796
23:49:22
mfiano
hayley: Hehe, I was referring to Robert Nystrom's article, but I can't argue with the Floyd.
23:50:46
_73
Question about exporting symbols that are only used as arguments to a function: http://dpaste.com/HVTYXNY9G
23:52:30
mfiano
Keyword symbols are self-referential, and suite uses like enum variant testing such as this well, and need not be qualified.
2:38:12
semz_
I'm not happy to ask this, but does there exist a CL implementation that compiles to Javascript?
2:39:28
Guest74
_death: while interesting it wouldn't work. This would be for reading/writing to dumb buffers gotten from drm.
2:42:10
Guest74
bike: shouldn't it be possible to have the header in lisp and simply have the pointer to the data point to foreign memory? Or header and data are contiguous?
3:43:02
dbotton
Wanted to share very early work on CLOGs GUI/Web Builder https://usercontent.irccloud-cdn.com/file/yq1ZLK9b/Screenshot%20(2).png
3:50:31
dbotton
That is all running in a web browser, of course can run "native" by using electron / ceramic, or add the panels to any web page of any framework of any language by a simple include.
4:12:45
_death
like I said, these limitations are not inherent to the approach.. but looking at DRM dumb buffers, it indeed might not work, because you don't get to pick the buffer's offset
4:14:53
Guest74
ah, I just read the readme and haven't looked at the code yet. It might be useful for clx though. X allows you to provide the mmap.
4:17:02
Guest74
it's just something that would be interesting for the future. copying the array to foreign is sort of a poor mans double buffering.
4:17:15
_death
the way it works is to have a page before the pages of interest where the last bytes are the array's header
4:21:46
Guest74
I was just thinking of the shared memory extension, but sounds like it'd possibly work for the buffer as well.
4:24:40
_death
but this header creation etc. really belongs to the implementation.. so it should probably be a contrib or something
4:27:49
Guest74
I think I eventually need to run on something besides sbcl. Maybe once everything is working smoothly.
5:30:32
abrahms`
Hi all. I'm trying to figure out how to iterate across the Nth item of a bunch of lists. I have a list of lists. I want to process the first element of each list, then the second item of each list. I feel like there should be a way to do this without setting a variable and looping index by index.
5:50:00
akater[m]
abrahms`: apply mapcar or apply mapc, or it's unclear what you want, show a form&result snippet.
5:51:46
abrahms`
Then I would want to map over the result, so if it's combined with map, that's great.
5:54:51
abrahms`
T_T I'm terrible at this right now. Spent 2.5hrs on it yesterday in what would have taken me ~20m in python.
5:55:27
abrahms`
I conceptually know what I want to have happen, and I'm fairly certain it's doable (and maybe even a good idea?) in lisp.. I just don't know the incantation for it.
5:56:40
abrahms`
Guest74: Yes. Didn't occur to me that it may spoil things for others until you just asked. :-/
5:57:30
Guest74
The test examples help to find stupid errors. I keep forgetting that and wasting time, finally got it after using the test data.
6:00:58
akater[m]
abrahms`: btw If you have only two list elements, maybe just write a loop with 2 for clauses.
6:08:24
abrahms`
Day one was mostly fine. I was struggling to figure out how to load in a test runner. Day two was spent figuring out how to correctly convert a string into a callable symbol. I had forgotten about funcall. :-/
6:10:40
Catie
Guest74: This is what I came up with, I don't think it looks that bad: http://ix.io/3GQq
6:12:03
Guest74
catie: reverse! why didn't i think of that. Summing also looks nicer, I was dpb'ing bits.