freenode/#lisp - IRC Chatlog
Search
21:21:36
Oladon_work
jackdaniel: it's a thought exercise — he's not actually arguing with your opinion.
21:36:26
aeth
my earlier point on CLOS, though, was that people tend to use it pretty lightly afaik, though.
21:38:22
aeth
I'm not sure "defmethod" for generics is really "using CLOS". At least not compared to some of the stuff I've seen using CLOS (I've even done some light MOP myself).
21:38:57
Oladon_work
I'd tend to agree. I've seen people using defmethod for a single method that will never have any sort of specialization, and to me that's not using CLOS either
21:39:18
aeth
Oladon_work: well, as long as it's exported, it does have some limited utility, if someone wanted to add an :after or :before or :around to it
21:40:08
aeth
But in most cases it probably just slows things down for nothing... You don't need defmethod if you're working on a standard object! Only when you need (or your users need) to use one of defmethod's features!
21:40:37
Oladon_work
I'm writing a game engine which implements the rule set of a popular tabletop RPG. The ruleset includes the concept of an "attack of opportunity", which is an interrupting event.
21:44:09
aeth
Oladon_work: I think a truly robust API for general use probably should wrap every major exported function (* yes, functions aren't exported, symbols are) in an extra method in case someone did want to before/around/after it, or define it for other, similar objects... Probably would bloat things quite a bit, though.
21:44:32
aeth
Not ideal, since it would also not override any internal function usage if it's just a layer on top of the functions... unless the methods use each other.
21:46:15
Bike
i mean, making everything exported generic functions just so that programmers can wrap methods is the basis of mop
21:48:06
Bike
most of them are things that are never called in user source, or maybe even can't be, like slot-unbound
21:49:29
aeth
Well, this would more be about defining two public APIs, where everything exported has two versions. So e.g. the method foobar* calls the function foobar. Perhaps with some of the methods going deeper so there are some interactions that can be overriden.
21:49:53
aeth
Interestingly, there is a convention for a low-level %foobar variant of foobar, but not a convention for a high-level variant of foobar!
22:23:58
pjb
aeth: it is sufficient to declare those functions as notinline, so that the user may substitute it with advices.