Search
10:11:27
jmercouris
(defclass fish () ()) (defclass salmon () ())
10:11:36
jmercouris
now how can I make (make-instance 'fish) make a salmon instead?
10:11:55
shka_
jmercouris: you redefine class
10:12:27
shka_
(defgeneric make-animal (class &rest initargs))
10:12:47
shka_
(defmethod make-animal ((class (eql 'fish)) &rest initargs)...
10:13:10
jmercouris
but I want to somehow change the name of the class
10:13:15
jmercouris
so that it works as I have outlined
10:13:41
jmercouris
I don't want to replace my make-instance 'xyz with make-animal, as it is meant to be consumed by users other than me
10:13:52
jmercouris
and they may not think oh, I need to use the make-animal method rather than make-instance
10:14:19
shka_
well, i would rather do this than play with MOP
10:14:38
shka_
also, you can keep dictionary of class aliases
10:14:48
jmercouris
I don't know how that would help me
10:14:50
splittist
jmercouris: but you're already lying to them about the class name?
10:15:16
jmercouris
It is an abstraction that they need not know
10:15:25
jmercouris
but the class they are actually instantiating is one that they extend
10:15:43
shka_
i found that trying to force lisp not behave as lisp is generally speaking a bad idea
10:16:06
jackdaniel
sounds complicated, I'm not sure if anyone will appreciate that you make something what looks like a fish behave like a dog
10:16:07
jmercouris
what we currently do is (make-instance *class-of*) or whatever
10:16:21
jmercouris
where *class-of* points to whatever class we like
10:16:52
jackdaniel
(like shadowing #'+ to work like #'-
10:17:15
shka_
jmercouris: that does not sound like a bad idea honestly
10:17:43
shka_
well, you CAN shadow make-instance to work as you want to
10:17:49
jmercouris
I don't want to shadow make-instance
10:17:54
jmercouris
I just want to rename my class during runtime
10:18:06
jmercouris
I'm okay with clobbering the salmon class or whatever class
10:18:24
splittist
I've always thought of make-instance as pretty low-level, and make-FOO as the (an?) appropriate 'user' inteface
10:18:43
shka_
splittist: that's my impression as well
10:18:53
shka_
jmercouris: ok, in that case (setf find-class)
10:19:06
jmercouris
setf find-class will work?
10:19:13
jackdaniel
(setf (find-class 'bar) (find-class 'foobar) )
10:19:19
jackdaniel
if you want only to rename it
10:19:26
jmercouris
yes, I only wish to rename it
10:19:34
jmercouris
I will let you know if this backfires on me :-D
10:19:46
shka_
i hope not, but i expect it :P
12:14:32
beach
jmercouris: (defclass fish () ()) (defclass salmon () ()) (setf (find-class 'fish) (find-class 'salmon)) (make-instance 'fish)
12:15:52
beach
jmercouris: Renaming the class is an entirely different thing than what you initially said you want.
12:18:16
beach
Oh, jackdaniel already said that. Sorry.
13:13:39
luis
TIL ASDF loads a system and its dependencies using a single with-compilation-unit. That's unfortunate.
13:19:06
phoe
wait, *single* for everything?
15:45:13
Lord_of_Life_
** NICK Lord_of_Life
16:46:23
gendl
luis: So, should it be one compilation unit per individual system?
20:35:47
phoe
that would be my intuition