libera/#commonlisp - IRC Chatlog
Search
9:38:34
ecraven
I've implemented something like tinyclos in a normal Scheme, and the main task was generic functions, once those work, it's just more implementing
9:39:26
beach
ns12: Adding CLOS to a pre-ANSI Common Lisp system mainly requires the addition of funcallable-standard-object.
9:39:55
ns12
Are there libraries that provide standard compliant structures, but with extra features?
9:41:22
beach
ns12: The macro only? Assuming the implementation already has a STRUCTURE-OBJECT and a STRUCTURE-CLASS? That's just a matter of macrology.
9:43:38
ns12
I still have much to learn about Common Lisp, so this might be some kind of long-term project.
9:45:49
ns12
I have read many Common Lisp programs, written some programs in Common Lisp, read PAIP, ANSI Common Lisp, Practical Common Lisp, and parts of the HyperSpec. But I still feel a overwhelmed by the flexibility of this wonderful language.
9:48:26
ns12
I will probably try to read CLtL, but I am concerned that it is not 100% ANSI Common Lisp. Is there some kind of document that summarizes the differences between CLtL and ANSI Common Lisp?
9:48:53
lisp123
https://stackoverflow.com/questions/108537/what-are-the-main-differences-between-cltl2-and-ansi-cl
9:50:29
beach
ns12: The only remedy I can think of for being overwhelmed is to practice more and read even more.
9:58:03
beach
ns12: One of the documents you may be interested in at some point is the AMOP. It explains how CLOS works, and also how it can be implemented.
12:09:47
pve
Hi, is there a big difference between doing (eval `(defmethod foo ...)) and creating the method "manually" followed by (add-method #'foo my-new-method)?
12:21:31
lisp123
if you are speaking in terms of writing these forms in a file, then obviously, the latter is faster
12:22:10
lisp123
but working in a live, running image, given that defmethod is already a top-level form, my suspicion is that they might be the same
12:27:06
lisp123
defmethod is a macro, so some of its work will be done in compile time vs. load time
12:29:04
lisp123
Sorry, I guess you were referring to doing the parts of defmethod manaully in your latter part --> so what I just said may not apply directly, but to the extent there are any macros within those parts, it will be faster
12:30:11
pve
lisp123: yes, I mean (make-instance some-method-class ... ) and the whole make-method-lambda deal
12:31:33
lisp123
I see. Will wait for someone else to respond, but in the meantime (I have to jet), here's the source of defmethod (https://plaster.tymoon.eu/view/2730#2730)
13:35:12
pve
beach: but is defmethod the only way to create a new method using CL only (i.e. no MOP)?
14:06:20
pjb
ns12: com.informatimago.common-lisp.cesarum.utility:define-structure-class implements the defstruct API using CLOS, so I would say it qualify as a library providing standard compliant structures, but with extra features.
14:09:49
pjb
pve: and perhaps other implementation specific details your implementation defmethod does…
15:33:35
Guest74
so I'm revisiting and cleaning up my ioctl stuff and see that i've kept c style names for structs and constants. I'm wondering if I should keep them exactly like this since that's what all the manuals/tutorials on the internet say, or lispify them?
15:35:54
pjb
Guest74: depends. I split by ffi stuff in two layers. a lower layer where I stick to C, and a higher layer, where I lispify.
15:37:12
Guest74
I've thought of that, but since they're just ioctls and not actual ffi to a library I'm wondering if that's even worth it.
15:38:38
Guest74
I'm also wondering if it's a terrible idea to replace all foreign structs with just static-vectors and then have lisp side functions to access the array as the struct slots. I'm not sure if that is more work, or faster for setting/getting.
16:18:42
Guest74
anybody know how to translate this to lisp from c? 1000000000UL/a I have no idea what's going on in the c.
16:36:13
semz
Guest74: If a is a float or double, 1000000000 would be converted to that first. / does the same thing in CL if a is a floating-point number.
16:37:16
semz
If you translate C names to Lisp names, I'd recommend being extra careful that your scheme is consistent and intuitive though; speaking from experience, it's infuriating when you have to look up how each name was translated in the manual when you're familiar with the underlying foreign API.
16:43:27
beach
On the rare occasions that I had to use a Lisp interface to a C library, I found it infuriating to have to consult the manual for the C library at all. I expected a consistent, well documented Lisp interface that did not refer to the underlying C library or its concepts.
16:55:41
Guest74
beach: it's not a foreign library, it's just ioctls. How do you handle interfacing with the linux kernel?
16:57:24
beach
I haven't given any thought to that. But some day I guess I will have to, given that I want a Lisp-y POSIX library at some point.
16:59:40
Guest74
I figure the lispy interface should be built on ioctls, since, as far as i understand, that's how you interact with the kernel. the ioctl level being not so lispy.
17:00:55
Guest74
I figure the person writing the lispy interface wouldn't mind the c-ness of the ioctl interface since all documentation for the kernel is written that way.
17:04:59
Guest74
though at the same time, I'd also like to change things like DRM_IOCTL_MODE_GETRESOURCES to drm-ioctl:mode-getresources , which kinda makes sens to me. But then how for do I go? drm-ioctl:mode-get-resources?
17:10:01
beach
I might create one Lisp function for each type of IOCTL, rather than maintaining the interface. But I think you are saying that that's someone else's job.
17:11:29
Guest74
yes, I figure in the higher level library, the equivalent of libdrm in c, it would just be a function, and no trace of ioctls would be seen.
17:13:16
Guest74
lol, preferably. I suspect that would be more work and I'd rather just start using the parts I need. However, I would like to at least standardize the lisp representation of ioctls.