]> gitweb.factorcode.org Git - factor.git/commitdiff
slots: adding check-slot-value
authorJohn Benediktsson <mrjbq7@gmail.com>
Thu, 21 Sep 2023 03:12:11 +0000 (20:12 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Thu, 21 Sep 2023 03:12:11 +0000 (20:12 -0700)
core/slots/slots.factor

index 0618975b9b353c8d44a8859c1d0895a0973408c6..f586364dc068af9965c45de85f1b4b62fe3ba805 100644 (file)
@@ -67,6 +67,9 @@ M: object reader-quot
 
 ERROR: bad-slot-value value class ;
 
+: check-slot-value ( value slot -- )
+    class>> 2dup instance? [ 2drop ] [ bad-slot-value ] if ; inline
+
 GENERIC: instance-check-quot ( obj -- quot )
 
 M: class instance-check-quot