freenode/#lisp - IRC Chatlog
Search
10:51:40
Xach
jmercouris: You write nonsense and don't seem to be able to accept correction. I don't want to expose that to a wider audience.
10:54:54
Xach
Or rather, I don't want to actively help expose it - it can get plenty of exposure through many other means without my assistance.
11:27:44
Nilby
The things in https://nyxt.atlas.engineer/articles don't trigger my lisp nonsense meter very strongly. Is there something I'm missing?
11:28:58
Xach
I skimmed through the non-marketing articles for Lisp info - one of the first that jumped out says "closer-mop is not portable"
11:29:54
Xach
It's certainly possible that closer-mop is unsuitable for some reason but portability is a goal and if it falls short some context would be useful.
11:34:56
jackdaniel
portability libraries are not "universally" portable by definition, because their purpose is to span multiple implementations (so each implementation is special-cased)
11:35:45
jackdaniel
still, they are far more portable than implementation-specific package; also they usually leave door open for adding support for new implementations by providing convenient api
11:58:34
jmercouris
here is the context: "We first tried to set the slot default value directly by leveraging the introspection library closer-mop. It worked with the SBCL compiler but was not portable and very brittle, it was particularly difficult to handle inheritance correctly."
12:02:25
jmercouris
jackdaniel: interesting how you didn't make a comment when Xach said that I just "spew nonsense", apparently, not a personal attack?
12:04:12
cl-arthur
how did you try to use closer-mop to set the default values of the slots? Isn't setting the default values as easy as supplying a :initform or some :default-initargs?
12:04:32
jmercouris
cl-arthur: it is about taking a class that exists, and changing the default value
12:04:40
jackdaniel
putting my opinion aside, the former was explanation why he refuses to included what you write (i.e "because it is a nonsense"), the above otoh is ad hominem kind of argumentation
12:07:47
jmercouris
See through your bias, and see what you've written is false, he did not say my writing was nonsense, he said I write nonsense
12:08:15
jmercouris
We've had this exact discussion many times, where you point out the difference between the noun and the verb
12:09:38
jackdaniel
if you want to customize the initform, you are looking for the generic function slot-definition-initform
12:10:24
jackdaniel
s/customize the initform/customize the form used to initialize the slot when no initarg is supplied/
12:18:39
cl-arthur
should be possible to e.g. setf the initform/initfunction of the existent slots of an existent class appropriately when loading a config, yeah
12:21:14
jackdaniel
cl-arthur: afaik it is not an accessor (only a reader), so you can't effectively setf it and expect that make instance will work
12:21:24
Nilby
Is there some accepted way or library for user object configuration/customization? I know about Shinmera's ubiquitous, but it's a little diffrent goals. I have a couple of ways that I'm not statisfied with. How does CLIM handle it? It seems like anything in CL must be better than "custom" in Emacs.
12:22:50
jackdaniel
(also, changing a method a standard slot definition won't probably have an effect, one would need to have their own slot definition class)
12:26:09
scymtym
Nilby: i made https://github.com/scymtym/configuration.options which has a moderately flexible core but is a bit biased towards configuration via files, environment variables and commandline options. i think i made a CLIM-based configuration editor for it, but there would be no way to persist the changes, so that's only semi-useful
12:30:01
jackdaniel
jmercouris: one way to do that (and it will /probably/ work) is: http://turtleware.eu/static/paste/3094e785-zzz.txt
12:38:33
jackdaniel
or, you could return some function that is global and is properly redefined (that is that after redefinition it is eq to itself - i.e a generic function)
12:45:35
cl-arthur
or metaclass -> slot-definition subclass w/ config-value as extra slot -> populate those when loading config -> make a method on slot-definition-initfunction like (if (config-value ...) (wrap-config-value ...) (call-next-method)).
12:46:27
jackdaniel
yes, having a custom effective slot definition class is the way, that's why I've said "probably"
12:47:54
jmercouris
we’ve already committed to a different strategy for now, but maybe some of these concepts could be useful again for us
12:49:07
jackdaniel
if I had wanted to customize a new instance slot values, I'd simply write initialize-instance method, there is no need to use mop here
12:49:55
jackdaniel
(defmethod initialize-instance :after ((thing foo) &rest args) (setf (slot-value thing 'x) *my-new-default-value*))
12:53:13
cl-arthur
a global map from class/slotd to config values, and some initialization method specialized on a mixin also seems decently clean yeah
12:55:13
jackdaniel
hm, til you could put a form as a default-initarg, however it is not surprising after a thought, so scratch the part "if it is a value, not a form"
14:35:48
jmercouris
globals, and we wanted to actually change the classes themselves so that inspecting them would show new default value init forms
14:37:19
_death
from what I gathered it sounds like you wanted to avoid something like "factory method" and instead chose to redefine classes?
14:51:05
_death
by "factory method" I mean you could have something like a *configuration* special variable that a user sets to (make-instance 'my-configuration ...) and then there are methods like (defmethod config-create-buffer ((config my-configuration) &rest args) (apply #'make-instance 'my-buffer args)) and possibly a convenience function create-buffer that passes *configuration* to config-create-buffer
14:59:42
jackdaniel
the most portable way to change the initform (and the associated function) is to redefine the class, common lisp has your back and that operation has well-defined semantics (i.e your instances won't stop working etc)