freenode/#lisp - IRC Chatlog
Search
5:45:46
Shinmera
seok: "all it does" is pretty dismissive of the amount of work involved in actually doing so.
7:23:23
scymtym
this SBCL commit https://github.com/sbcl/sbcl/commit/ab976f48db4ba8d72fb7bc13388bc4fc6e97c0fd will break named-readtable here https://github.com/melisgl/named-readtables/blob/master/src/cruft.lisp#L166
7:52:21
pve
Good morning! Is there a tutorial somewhere on how to define new asdf component types (specifically modules)? Something a bit more detailed than what's in the manual..
7:56:52
pve
I'm going to have a directory containing some source files and a custom loader that knows how to compile and load them. So now I'd like to tell asdf about the custom loader.
8:01:19
easye
pve: unfortunately there is no good tutorial to extending ASDF that I know of: I learned about ASDF from copying what others had done, and studying the ASDF source code.
8:02:24
easye
<https://gitlab.common-lisp.net/abcl/abcl/-/blob/master/contrib/abcl-asdf/abcl-asdf.lisp> extends ASDF to understand :mvn components, and might be interesting.
8:03:03
easye
There is an extension for ASDF for dealing with Parenscript artifacts somewhere that might be a conceptually a little more in line what you want to do.
8:06:39
easye
A reasonable strategy to search for examples would be to examine Quicklisp systems that end in "-asdf" as these are usually ASDF extensions.
8:16:19
nicktick
how to define a function (compose f g) which could be used as (funcall (compose #'char-upcase #'code-char) 100) ?
8:17:56
Harag
finally got sbcl and woo to work on "google cloud run" using buildapp to get around the HOME switching (/root to /home) that the "google cloud run" is doing on CMD command
8:21:59
McParen
if I define a function A, then define an alias B using (setf (fdefinition 'B) #'A), I get warnings when trying to use that new alias immediately when defining the next function.
8:22:54
McParen
yes, they are in the same file. i figured out that i have to use an eval-when, but i dont really understand why
8:22:58
nicktick
why don't use (defun compose (f g x) (funcall f (funcall g x))) and (funcall #'compose #'char-upcase #'code-char 100) ? the result is the same as (defun compose (f g) (lambda (x) (funcall f (funcall g x)))) and (funcall (compose #'char-upcase #'code-char) 100).
8:23:11
beach
McParen: Top-level forms in a file are executed when the file is loaded, but you get the warning when the call is compiled.
8:23:15
no-defun-allowed
Try (eval-when (:compile-toplevel :load-toplevel :execute) (setf (fdefinition 'b) #'a))?
8:23:28
no-defun-allowed
nicktick: Because the former doesn't really perform composition, but the latter does.
8:24:01
McParen
no-defun-allowed: i have already figured that out, but dont really understand why. are the defun and setf not evaluated at the same time?
8:24:48
no-defun-allowed
I think the compiler gets function binding information at compile time, and the SETF isn't done at compile time; but I'm not very well versed on those.
8:25:26
beach
McParen: What no-defun-allowed said. You get the warning when the file is compiled, and then the DEFUN and the SETF have not been executed yet.
8:27:14
beach
If this is SBCL, at compile time, it checks whether the function being referred to exists, and if not, gives a warning. But the standard says that the definitions do not happen until the compiled code is loaded. And that includes other top-level forms like (SETF ...).
8:28:50
beach
Now, for the first top-level DEFUN, the SBCL compiler makes a note that it WILL EXIST at load time and doesn't emit any warning. But the (SETF (FDEFINITION ....)) does not result in such a note being made.
8:30:17
McParen
thanks, that makes sense, the function using the alias had no runtime errors, it was a compile time warning by sbcl.
8:31:37
beach
McParen: I suggest you read the Common Lisp HyperSpec page on DEFUN. It can be instructive.
8:32:20
no-defun-allowed
nicktick: Now, if I was to rearrange that, we get our definition of COMPOSE: f o g = λx . f(g(x))
8:32:29
nicktick
I can write function (compose f g x) == f(g(x)),but it's not (compose f g)(x) == f(g(x)) , so I should use a lambda function to define (compose f g)(x). is it right ?
8:32:48
beach
McParen: "In particular, DEFUN does not make the function definition available at compile time."
8:33:27
no-defun-allowed
Yes, you need to return a function of one argument that calls g with the argument, then f with the value of that.
8:33:49
beach
nicktick: You don't want the ultimate argument to be part of the composition. You want the composition to work for any argument.
8:35:22
no-defun-allowed
The Alexandria implementation allows for an arbitrary number of arguments, and an arbitrary number of functions to be composed, but in the case of one argument and two functions to compose, it is basically the definition I gave.
11:42:12
Xach
|3b|: fyi http://report.quicklisp.org/2020-06-12/failure-report/3b-hdr.html#3b-hdr_test
12:42:43
flip214
COMPILE returns multiple values, for warnings etc. Is there a way to get these as conditions?
12:48:05
|3b|
guess i could try using just enough d3d or vk to talk to that and do the rendering in GL, assuming they haven't added it by the time i get back to VR coding
14:48:52
pjb
But for an English speaking person, it's strange to say it's French, since English is the most latin german language, and French is the most german latin language. Basically English and French are the same, only English got the pronounciation all wrong.
14:51:52
pjb
You could say it's heptapod language to you. :-) https://www.wired.com/2016/11/arrivals-designers-crafted-mesmerizing-alien-alphabet/
15:37:24
Josh_2
With the MOP could I create a superclass that creates a lock for each slot within my class?
15:38:10
Josh_2
perhaps using the reader I could determine whether atomic operations could be used instead
15:39:28
phoe
you can create custom slot classes, create a custom metaclass to generate the locks, and modify the slot access protocol on the custom slots to perform (with-lock-held (...) (call-next-method))
15:39:30
pjb
Josh_2: AFAIK, this lock would only work around slot-value. This design would probably be very defective when you use other accessors.
15:41:03
phoe
if they do, then custom methods on SLOT-VALUE-USING-CLASS will have a chance to be invoked
15:41:16
pjb
Josh_2: probably, but specifically in the cases where it becomes difficult, it's the programmer who writes the accessor.
15:42:41
Josh_2
I use locks quite a lot and It's a bit of a pita, so something like this is certainly a future project idea
15:45:14
pjb
(defclass bank-accound () ((balance :initform 0)) (movements :initform '())) (defmethod deposit (b a) (incf (slot-value b 'balance) a) (push `(deposit ,a) (slot-value b 'movmements))) (defmethod movements (b) (decf +get-movements-fee+ (slot-value b 'balance)) (copy-list (slot-value b 'movements)))
15:46:29
Josh_2
well if I can't change the default behaviour of (slot-value ..) with this class then I'll just say "don't use slot-value" xD
15:51:13
Bike
you can change what slot-value does. i think pjb is attempting to describe the classic bank account problem: https://en.wikipedia.org/wiki/Concurrent_computing#Coordinating_access_to_shared_resources
15:51:31
Bike
in which locking around individual accesses to the quantities is not sufficient to ensure correct behavior
15:56:35
aeth
Don't name your slots the same as their accessors. I always prefix them with %, e.g. (%foo :accessor foo :initform 42)
15:57:46
aeth
But you can do more, e.g. I guard the setting of slot-value (mainly so I can cover both the initial set and the later accessors) with https://gitlab.com/zombie-raptor/zr-utils/-/blob/master/metaobject.lisp
16:04:54
aeth
Your situation would require more, though, since all I'm trying to do with my MOP manipulation is ensure that the type remains unchanged so that I only have to typecheck once. (I came up with my system because I kept getting random NILs and they're particularly annoying in a game engine since they freeze the whole thing and they're never where the NIL was produced.)
16:06:27
aeth
You are probably going to end up having to write custom sequences if you want to guarantee locking and you use sequences.
16:34:35
pjb
Bike: well, the classic bank account transfer operation involves two bank account objects. My example is worse: it's a single operation on a single object, but it involves two slots.
16:34:57
pjb
Monitors don't put locks around slot-value or accessors, but around all the methods of the object.
16:35:31
pjb
My example would be solved by monitors. The classic bank account transfer operation wouldn't be solved by monitors. This is probably why monitors are not in widespread use.