freenode/lisp - IRC Chatlog
Search
9:45:16
theothornhill
Hello! How do you decide between separate defmethods, or use the (:method) syntax on generic functions? Are there any tradeoffs with one or the other?
9:46:51
no-defun-allowed
Usually I put a class definition and any methods in the same file, so I would rarely be able to use :method syntax if I wanted.
9:47:07
beach
The latter requires the method definition to be in the same file as the DEFGENERIC form, so that's already a limitation. If you modularity requires them to be in a separate file you have no choice.
9:47:28
no-defun-allowed
But I use :method for "default" methods which the programmer should know about immediately sometimes, and whenever I use DEFGENERIC as a lazy person's pattern matcher.
9:48:03
beach
Or, you can use :METHOD when you have only a few methods that specialize to built-in classes.
9:49:43
beach
Methods defined with :METHOD are removed when the DEFGENERIC form is re-evaluated. Not so with separate methods defined using DEFMETHOD.
9:51:05
theothornhill
You mean the "old" version is removed if you change a :METHOD method and re-evaluate?
9:51:17
beach
But, yeah, I agree with no-defun-allowed. Often, the best place for a method specializing to some class C is in the same file as the DEFCLASS form for C, whereas DEFGENERIC forms are usually in a separate file.
9:52:26
beach
Or if you change some other aspect of the generic function, like the method combination.
9:58:22
vydd
Hey! I'm trying to do some CL programming after a relatively long time, and for my project I'd like to use https://github.com/plkrueger/CocoaInterface. However, it doesn't seem to play nice with asdf (or at least that's how it looks to me). There are docs on how to setup the environment using the ccl-ide-init.lisp file, in which *module-search-path* is updated to contain CocoaInterface, but when I quickload my project from sly, it
10:37:25
vydd
jmercouris: googling around, your named popped up in a discussion related to migrating CocoaInterface to use a system. https://github.com/nEXT-Browser/CocoaInterface doesn't seem to be available anymore. Did you ever manage to make it work, or did you hit a road block?
11:12:42
rumbler31
once long ago I played with something like that on windows, but the experience wasn't great, mainly because the cocoa interface on windows was likely incomplete
11:52:10
jmercouris
vydd: you’ll have to look at this repository : https://github.com/atlas-engineer/nyxt
11:53:26
jmercouris
I actually more or less use the objective c bridge independently of the cocoa interface after some point in time
13:30:59
nij
Hello! I can ql:quickload :sb-cltl2 from an sbcl repl. But when I put that in my stumpwm config, it doesn't know where to find.
13:32:28
no-defun-allowed
I think that would call (require :sb-cltl2) and not ASDF, so it is up to how SBCL finds its own modules.
13:39:48
no-defun-allowed
Quicklisp doesn't control how SBCL stores its contrib(?) modules, so it is understandable how any other module would load correctly.
13:42:03
Bike
i think sbcl loads contribs by looking at $SBCL_HOME, which might be different between the repl and stumpwm
13:52:18
Bike
ok, well, i was looking at module-provide-contrib, which says it "[stringifies] and [downcases] NAME, then [attempts] to load the file $SBCL_HOME/name/name". but it seems to do a little more than querying the shell variable
13:58:43
lotuseater
is it equivalent to say (defun sqr (x) (* x x)) and (compile 'sqr '(lambda (x) (* x x))) ? :)
13:59:44
Bike
and the second one will probably lack (implementation-defined) compile time side effects like suppressing undefined function warnings for sqr, and such.
14:03:05
nij
Unalbe to load any of the alternatives: ("libssl.so.1.1" "libssl.so.1.0.2m" ...) [Condition of type CFFI:LOAD-FOREIGN-LIBRARY-ERROR]
14:03:36
Bike
sbcl uses dlopen to find libraries, and as far as i can tell from people being confused here, guix totally hoses it
14:06:19
lotuseater
but don't worry, loading drakma in SBCL also throws me into "libssl not found" :D
14:06:48
Bike
i haven't used these systems myself. i'm just going off of what people have said here in the past.
14:08:26
lotuseater
i worked around that with other packages by pushing some paths to cffi:*foreign-library-directories* in .sbclrc
14:11:03
nij
Now that variable is NIL in my repl. I gotta ask the guix community where those .so files are.