Gauche > Archives > 2025/02/05

2025/02/05 11:52:41 UTCkaki
#
同一のオブジェクトになるかどうかはともかく、(subtype? T (</> T T)) かつ (subtype? (</> T T) T)) になってほしさがあります。
#
gosh> (subtype? <char> (</> <char> <char>))
#t
gosh> (subtype? (</> <char> <char>) <char>)
#f
gosh> (subtype? (</> <integer> <float>) <number>)
#f
#
全部 #t を期待したのですが、何かおかしいですか?
2025/02/05 12:46:12 UTCkaki
#
gosh> (subtype? <number> <float>)
#<undef>
gosh> (subtype? (</> <integer> <real>) <number>)
#f
2025/02/05 12:56:38 UTCkaki
#
<float> がうっかりnative typeのやつだったのと別のバグがありそうなので、<real> で
2025/02/05 18:06:38 UTCkaki
#
<float> のは
-    [(SCM_NATIVE_TYPE_P super) (return FALSE)]
+    [(SCM_NATIVE_TYPE_P super) (return SCM_FALSE)]
かしら
2025/02/05 18:32:21 UTCkaki
#
(subtype? (</> <number>) <number>) みたいなケース、(:subtype? (</> <number>) <number>) が呼ばれて 'super が返る -> (delegate-to-super (</> <number>) <number>) で (SCM_DESCRIPTIVE_TYPE_P <number>) が #f で (</> ...) の中身によらず #f になっちゃってます?
2025/02/05 18:54:27 UTCkaki
#
gosh> (slot-set! </> 'subtype? (^[type super] (if (or (is-a? super </>) (is-a? super <class>)) (every (cut subtype? <> super) (~ type'members)) 'super)))
#<undef>
gosh> (subtype? <char> (</> <char> <char>))
#t
gosh> (subtype? (</> <char> <char>) <char>)
#t
gosh> (subtype? (</> <integer> <real>) <number>)
#t
gosh> (subtype? (</> <integer>) <number>)
#t