freenode/#lisp - IRC Chatlog
Search
11:49:28
Demosthenex
though i'd expect using the upper level api to cl-charms, only a handful of basic terminal handling operations are needed if mcclim is going to manage all the other logic
11:50:29
jackdaniel
if such backend is written some day (I certainly hope so, because that will reveal many weird bugs, I'm sure about that), you wouldn't have to care about terminal at all
11:51:28
jackdaniel
you'll be able to run mcclim application in a terminal (of course terminal limitations will be still in place)
11:51:50
Demosthenex
i'm a complete noob, but if there were a way i could contribute, i'd be happy to
11:51:54
jackdaniel
I even have a screenshot somewhere, where I managed to start "Hello world" application side-by-side in a window and in a terminal
11:52:33
jackdaniel
there are many ways to contribute. first step is learning clim basics ;) there is #clim channel if you are intersted in socializing
11:52:34
Demosthenex
i'm a jaded old fart. i despise webapps, i strongly dislike gui apps, i live on the command line and in emacs. if i'm going to make a small db for personal use, it'll be there.
11:54:10
Demosthenex
i just despair regarding reinventing the wheel. i feel like a whole generation of code has been lost regarding TUIs
11:58:59
jdz
dim: BTW, this is how I set up cl-log without "monkey patching" PRINT-OBJECT for cl-log:timestamp.
12:28:11
no-defun-allowed
I'm alright with guis but there should be a good keyboard alternative after I've memorised enough of my workflow.
12:28:37
no-defun-allowed
GTK/Emacs is the first example that comes to mind since you can navigate by menus but you'll pick up keyboard chords relatively quickly.
12:38:56
Xach
PuercoPop: I am much more likely to drop asdf from quicklisp. Implementations should provide the asdf that best suits their users.
13:58:25
oni-on-ion
no-defun-allowed: i've been using no mouse for about a month. my secret is 'keynav' for the gui apps
14:03:03
jackdaniel
otoh SBCL is boostrappable from any conforming implementation, so one could build clisp with gcc, and then sbcl with clisp
14:04:02
jackdaniel
well, it is said, that everything must be possible to build from source, but they look at building ccl with ccl that way afaik
14:04:17
pfdietz
At some point in the distant past some proto-CCL must have been built from something else, but that's probably long dead.
14:15:03
oni-on-ion
makomo: got quite good with it. took me a couple days of having fun because i never learned hjkl movement. it does directionals too, and shift+(key)
14:15:33
oni-on-ion
makomo: i am happy to find that most UI elements are in that pattern of "subdivision", which is also quite interesting philosophically =)
14:16:47
makomo
oni-on-ion: hmm very nice. i wonder how efficient one could get it. at first it seems "horrible", but i suppose i would think differently after a few days of using it/practicing
14:18:33
oni-on-ion
the fingers learn which directions for which button quite quickly. ie. dark mode toggle on firefox is 3 keys to hit, or the youtube search bar is 2 key.
15:26:10
Demosthenex
no-defun-allowed: so i prefer my tiling wm with terminals pre-allocated. guis and i don't get along. yes, good hotkeys and keyboard support in a gui make it better, but if i'm writing something it'll be text only. and firefox sucks now that they've forced end user windoze hotkeys on everyone forever.
15:28:37
Demosthenex
btw, i am very impressed reading this introduction to concurrency. https://z0ltan.wordpress.com/2016/09/02/basic-concurrency-and-parallelism-in-common-lisp-part-3-concurrency-using-bordeaux-and-sbcl-threads/
15:32:20
Demosthenex
bet i could use that for async input for keyboards and a shared locked queue of input events
15:52:19
phoe
I'm designing a server for a text-based game, and I noticed that I base literally everything around queues and message-passing in there.
15:53:25
phoe
And threads that block until a message is received, at which point they parse the message, do their job, and block again, waiting for a queue to get a message again.
15:58:07
oni-on-ion
been using exwm+emacs+keynav for some time, no mouse, firefox only when necessary
16:38:38
Demosthenex
oni-on-ion: firefox used to have firemacs, which let me have real emacs bindings... now its all windoze crap. i'm so mad
16:38:57
Demosthenex
phoe: do you have an example? that's an architecture i'd love to learn more about
16:44:36
oni-on-ion
Demosthenex: it and chrome has extensions for using emacs to edit text in text fields, used one for a bit it was quite nice. brings up an emacsclient but thats isnt much. i am looking forward to the "next" browser.
16:46:35
jackdaniel
phoe: assuming erlang was public around 1986 it can't be true, because commonloops (direct predecessor of clos) was proposed the same year
17:02:23
phoe
in there, connection is a data structure that doesn't act on its own. Acceptor has a thread that's waiting on connections to its listening socket, listener has a thread that's waiting on input on the connection sockets, writer has a thread that's waiting on jobs inside its internal lparallel queue.
17:14:53
phoe
There is a function VECTOR-PUSH that adds an element to its end. Is there a function like VECTOR-REMOVE that accepts a vector and an index, removes the element from that position, copies the last element to that position, and decreases the fill pointer?
17:19:57
jackdaniel
vector-push adds at the vector end, so its counterpart is vector-pop (which removes from the end)
17:33:07
Colleen
phoe: Unknown command. Possible matches: 8, set, say, mop, get, about self, logout, grant, block, award,
17:33:19
Colleen
phoe: Function array-utils:vector-pop-position https://shinmera.github.io/array-utils#FUNCTION%20ARRAY-UTILS%3AVECTOR-POP-POSITION
17:36:34
phoe
Shinmera: your function preserves order of elements and is therefore O(n). I don't need to preserve order and therefore it can be O(1).
17:37:53
pjb
(defun vecto-remove (v zombie) (rotatef (aref v zombie) (aref v (1- (length v)))) (vector-pop v))
17:38:13
phoe
rotatef will put the element I seek into the vector's tail, and vector-pop will fetch it for me and decrease the fill pointer.
17:39:10
pjb
(Let ((v (make-array 6 :initial-contents '(a b c d e f) :fill-pointer t))) (values (vecto-remove v 2) v)) #| --> c ; #(a b f d e) |#
17:40:12
pjb
Perhaps it'd be better to use (defun vecto-remove (v zombie) (decf (fill-pointer v)) (shiftf (aref v zombie) (aref v (length v))))
17:42:34
pjb
Bah! In a library, you'll want to add check-type for the arguments, and check that the fill-pointer is >0, etc.
17:44:04
pjb
or an error: &key (no-fill-pointer :error) (check-type no-fill-pointer (member :error :copy nil))
17:53:52
pjb
(defun vector-remove (v i) (prog1 (aref v i) (vector-delete nil v :start i :end (1+ i) :test (constantly t))))
17:55:46
pjb
The thing here, is that in a given program, you can have a lot of nuances and conditions that makes it simplier to write the exact function you need, rather than use a library function, even (or exactly because!) if it's very versatile with lot of different &key options..
17:58:37
flip214
does anyone have the link to csrhodes' PDF from June where he reports about the final results of 'Using Lisp-based pseudocode to probe student understanding' for his class?
18:04:31
phoe
Shinmera: https://github.com/phoe-trash/array-utils/commit/6309033661a7f9fc9f3b540bb08187b52ddde68d
18:09:44
flip214
minion: memo for Xof: please send me the link with the full results (whole year) of your 'Using Lisp-based pseudocode to probe student understanding' Moodle experiments; ISTR that you posted that in June or so. I'd like to forward that. Thanks a lot!
18:34:58
phoe
dlowe: https://upload.wikimedia.org/wikipedia/commons/thumb/9/98/International_Pok%C3%A9mon_logo.svg/2000px-International_Pok%C3%A9mon_logo.svg.png
18:46:39
_death
huh, neat.. I was thinking about pokemons and that I should update a program that scrapes UN "concerned" statements and generates a ban-ki-moon image with them as think bubbles.. at some point I disabled it.. now that I generated an image, however, I see that I don't need to update anything, as it reflects reality: https://adeht.org/img/ban.png
19:45:32
whartung
just curious if any of the current lisps support the idea of “volatile” variables.
19:46:52
phoe
as in, volatile from C language, meaning, "don't optimize this stuff, don't touch it, don't do anything with it"?
19:48:04
whartung
well, I’m thinking of the Java language where volatile variables will see changes done across cores in multi-threaded applications.
19:48:29
White_Flame
usually it means "always perform a real read & write when the source code says to" instead of caching it
19:49:37
White_Flame
in all the multithreading lisp stuff I've done, using your basic mutexes & such, I've never had a problem with multi-threaded access to shared variable
19:50:25
whartung
I’m thinking about atomiic “read and set” type of things, and “lockless” algorithms
19:51:38
pjb
whartung: threading is not considered by the CL language. An implementation that has threads could provide a declaration. You could (declaim (declaration volatile)) and (defun foo (x) (declare (volatile x)) …)
19:53:41
whartung
I think mutexes solve the problem, but they’re pretty heavy weight I dont know what their impact is on the caches when they happen.
20:09:03
AeroNotix
I'm getting errors just quickloading it: "Lock on package SB-VM violated when interning EMIT-SKIP while in package: SB-X86-64-ASM."
20:14:09
AeroNotix
Wonder why it's still in quicklisp, thought the CI process caught stuff like this.
20:15:25
phoe
it'll likely need to be dealt with in #sbcl since stmx is using internal symbols of sb-vm package
20:17:16
Demosthenex
oni-on-ion: yeah, windows swaps search and save vs emacs in firefox. control-s is save not search, adn control-f is find with a F key to cause repeates
20:17:19
phoe
AeroNotix: ha, look! http://report.quicklisp.org/2018-07-27/failure-report/stmx.html#stmx
20:19:07
AeroNotix
Weird, I thought they were removed if they didn't pass tests. Perhaps this is an omission/Xach thought it wise not to break dependencies?
20:20:13
AeroNotix
haha, it's actually weird. I had an idea on hacking on sbcl's internals with stmx as well actually. Whole reason why I loaded it up
20:23:51
oni-on-ion
Demosthenex: ahh right. and ctrl+g is search again etc . putting FF tabs as individual emacs buffers with EXWM does help a bit.
20:39:07
jasom
whartung: C's volatile is very lightly specified. It essentially says that accessing a volatile is a side-efect, and C does define when previous side effects must complete by (i.e. sequence points). This means it cannot remove accesses (since only side-effect free expressions can be removed) and it cannot reorder accesses across sequence points.
20:40:46
whartung
I don’t know how that differs from the java definition, or how they differ in practice.
20:40:48
jasom
whartung: most implementations give some additional guarantees, often specified in relation to the ISA, and in some cases the microarchitecture
20:42:18
jasom
one common additional guarantee is that the size of the access will match (e.g. a read write a pointer to a volatile 8-bit value won't cause a 32-bit read-modify-write on the bus, but it might for non-volatile accesses)
20:44:32
jasom
whartung: the spec as-written would guarantee that cores see volatile accesses on other cores only if a memory-write from one core is visible on other cores. For proper ordering, more synchronization may be needed (especially on non-x86oids)
20:45:03
jasom
as some microarchitectures do not enforce that issuing write instructions in order will be seen in the same ordering on another core
20:45:40
jasom
I think C11 now provides enough levers to do it in pure C, prior to C11, compilers would offer intrinsics that would essentially place synchronization instructions in the emitted code.
20:46:16
whartung
right, that’s what I thought something like that happens — some kind of hard sync between the cores.
20:47:27
jasom
pfdietz: compiler customers are notorious for overestimating what volatile is required to do as well :)
20:48:23
whartung
and I may be wrong, but it seems to be that volatile’s are important to lockless algorithms, but maybe CAS alone is adequate.
20:49:55
jasom
CAS removes the need for volatile in many cases because it explicitly performs the read and writes.
20:50:31
jasom
The typical CAS intrinsic has (nearly?) a superset of the guarantees that volatile provides
20:52:02
jasom
lockless Atomic modify can be implemented with a CAS, and atomic modify gets you many useful lockless algorithms, though there may be either forward-progess issues or slow performance for some algorithms if you build on top of that tower of abstraction.
20:53:05
jasom
and on multicore systems volatile will almost certainly not be enough, since cross-core synchronization is also going to be needed.
20:55:09
jasom
whartung: anyways when you get to gritty details, feel free to pick my brain since I've implemented a few simple lockfree algorithms on x86, arm and power.
21:14:17
asarch
I've done a few (ql:quickload...) and some (in-package...). Is there any SBCL command to wipe your session and start over again (anything else besides exit and restart again)?
21:19:12
whartung
but it’s an interesting question. For example, if I do (make-package “FOO”), then (in-package “FOO”), then (defun xxx ()), when I do a DELETE-PACKAGE, assuming no other binding, will FOO:XXX “go away” and be GCd?
21:19:59
phoe
so, if that symbol is not referenced anywhere in the image, it is free to be collected.
21:20:26
whartung
right, so, in theory, to “reset” he could delete all of the packages that he’s quick-loaded.
21:20:53
jasom
whartung: there are still things like DLLs that have been loaded, files that have been opened, &c.
21:22:14
whartung
outside of out-of-spec finalizers, there’s not much of a formal lifecycle for things.
21:22:51
|3b|
don't forget to delete all the print object methods, whoch keep refs to classes which ref names which ref ...
21:24:50
whartung
from a LispOS perspective (not wanting to open that, at all, really), I was always keen to understand how things were “forgotten”.
21:28:15
whartung
but that’s an interesting point regarding generic functions, and what holds on to them.
21:32:18
Bike
I guess the list of methods of a gf could be "weak" so that methods specialized on otherwise unused classes could be gced
21:33:44
jasom
beach recalculates the dispatch function whenever a method is added or removed though, right?
21:35:38
Bike
but if a method is collectable in this way, the discriminator doesn't actually need to be recomputed, since there's no way to call the gf with arguments of the gc'd classes
21:37:08
phoe
you'd need to explicitly make the method references in the discriminator weak, somehow
21:38:34
Bike
but conceptually there's no reason for a generic function to keep a method alive, i think.
21:38:44
phoe
yep, and you need to take them all into account when designing the CLOS implementation to make sure that methods are actually garbage-collectible.
21:39:24
phoe
Bike: basically, when a class becomes collected, then all methods specializing on that class are free to be collected, too, correct?
21:41:10
phoe
frodef: (defclass bar () ()) (defmethod foo ((bar bar)) 42) (setf (find-class 'bar) nil)
21:41:39
phoe
literally the only way for you to be able to call that method now is CLOS introspection
21:42:31
phoe
Bike: the issue is when you have (defmethod foo ((bar bar) (baz baz) (quux quux))) and when one of the classes becomes unreachable
21:43:54
phoe
frodef: if you have uncollected instances, then they refer to their class, so the class is reachable even if it's deleted
21:44:29
Bike
just putting a finalizer on classes would probably be okay. it's not like they're destroyed very often.
21:44:43
whartung
well, it’s not like you have a class and a list of generic functions. You have a list of generic functions and the dispatch arguments.
21:45:48
whartung
by that point, yes, in theory, if a class goes away then any generic function that is dispatched based on that class is “unreachable” via the dispath mechanism and could “go away".
21:46:19
phoe
when in a (defmethod foo ((bar bar) (baz baz) (quux quux)) 42) any of classes BAR, BAZ, QUUX are collected, then the method itself could freely be collected
21:47:20
whartung
in theory you would have a hard reference from teh symbol to the method, and a weak link from the “list of methods” to the method.
21:49:11
Bike
symbols just name generic functions. there are other ways to keep a generic function live.
21:50:15
phoe
you could (defvar *something* #'my-generic-function) and then (fmakunbound 'my-generic-function)
21:50:37
phoe
and 2) is lost but 1) is still live, since now a global variable refers to that function.
21:51:05
phoe
which brings me to another interesting question, storing methods for anonymous generic functions in the environment.
21:51:27
whartung
it just seems that “normally”, the “hard” references to the function would be tied to the naming symbol. Anything else (within the CLOS infrastructure) should probably be a weak reference.
21:52:28
phoe
I just wonder, if your generic function gets collected, you also need to collect its methods
21:52:56
whartung
that’s fine, but that doesn’t mean that the CLOS infrastruture should maintain hard references to them.
21:54:32
whartung
doesn’t this sort of work now since I assume the systems don’t leak memory when a generic function/method is redefined?
21:56:45
jasom
whartung: when a method is redefined, it still keeps the reference to the class around, so it's not really a parallel case
21:57:12
phoe
(defgeneric foo (bar)) (defmethod foo ((bar number)) 42) (defgeneric foo (baz)) (foo 1.0) ;=> 42
21:58:15
phoe
"if the new class given to setf is nil, the class association is removed (but the class object itself is not affected)"
21:58:19
Bike
actually destroying the object doesn't have a standard protocol any more than destroying any object does
21:59:31
pfdietz
method qualifiers should be weak references to their classes (or to objects, if EQL method qualifiers).
22:03:47
phoe
that's what (remove-duplicates (mapcar #'mop:method-qualifiers (mop:generic-function-methods #'print-object)) :test #'equal) tells me
22:07:32
phoe
and as long as they're unnamed, then we're already doing it in our garbage collection algorithms
22:08:33
phoe
we're talking about the cross-section of a CLOS implementation and a garbage collection algorithm
22:10:02
Bike
there's no need to manually destroy a class any more than there is to manually destroy any object.
22:11:06
|3b|
yeah, if you can find all the refs, removing a class, symbol, package works same as anything else
22:12:03
|3b|
just that for those, there are a lot, many of which are cyclic (but linked to other things so the whole cycle can't be collected), and some are hidden (like internal caches in GF dispatch or whatever)
22:12:24
phoe
and if you dare to have a reference to that class on a method on an anonymous generic function lingering in a closure inside some random instance somewhere inside a separate thread, then good luck finding that
22:13:01
|3b|
and that's before conservative GC, or some random half-dead loop variable somewhere up the stack happens to hit one
22:17:25
makomo
also, Jamie Zawinski who worked on early Netscape Navigator releases and thought of the name Mozilla, used to work for Lucid, Inc.