libera/commonlisp - IRC Chatlog
Search
14:07:52
beach
And you can achieve the same effect by integrating the key functions into the test function. But, sure, a second :KEY would be handy.
15:06:58
NotThatRpg
Anyone know who's running the `lisp-mirror` group on GitHub? I'm wondering if I need to do anything to make the ITERATE repo continue to be mirrored.
15:22:38
RavenJoad
I want to attach a class where I want to set its slot to have a type of another class. I mean (defclass ... (slot :type other-class)). I'm probably just missing something obvious. My goal is to have a list of allowed classes as the type of the slot.
15:23:28
RavenJoad
I have the whole deftype thing figured out already and am using it in other places, but those other deftypes only match against symbols or built-in classes/types.
15:43:53
RavenJoad
Oh. It might be simpler than I thought. My predicate function used by the deftype wasn't behaving. Obviously a class instance is not a member of a symbol.
16:15:05
jackdaniel
if your type is a set of classes, then you may also define it as (or class-1 class-2 ,@etc)
16:25:24
RavenJoad
Technically the type needs to be a list of a set of classes, but turning that set check into an every is easy.
16:32:03
RavenJoad
My current type is `(satisfies list-of-classes-p), where that predicate is (and (listp cs) (every (lambda (c) (member c allowed-classes)) cs))
16:32:52
jackdaniel
it is worth noting that the implementation is not obligued to check the type of the passed argument that initializes the slot
16:33:56
jackdaniel
to be fully covered (check-type wise) on the class initialization level, you'd probably need to have a custom metaclass for the class and for type-checked slots
16:35:45
RavenJoad
Yep! I have a TODO about switching to my own metaclass for these classes. SBCL has a relatively solid set of safety settings and catches this at my default settings (or it might be my sbclrc). Either way, I want to get this deftype down.
16:39:29
RavenJoad
I just don't know how to define the list/set of permitted classes in the allowed-classes parameter/var to make this pass. (defparam allowed-classes (list 'class-1)) does not work and doing (list class-1) leads to class-1 being seen as a variable and being unbound.