guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

The r6rs record-type in pattern matching of Guile-3.0


From: Nala Ginrut
Subject: The r6rs record-type in pattern matching of Guile-3.0
Date: Tue, 25 Aug 2020 04:16:08 +0800

Hi folks!
I found the r6rs record pattern matching has different results compared to Guile-2.
Here is the example code:

-----------------------------------------code--------------------------------------
,use (rnrs)
,use (ice-9 match)

(define-record-type aaa (fields a))
(define-record-type bbb (parent aaa) (fields b))
(define r (make-bbb 1 2))

(match r
  (($ bbb ($ aaa _ a) b) (list a b))
  (else "no"))
;; ==> "no"  in Guile-3
;; ===> (1 2) in Guile-2

(match r
  (($ bbb a b) (list a b))
  (else "no"))
==> (1 2)  in Guile-3
==> (<aaa> 2) in Guile-2
--------------------------------------------end----------------------------------------------

In Guile-2, we have to specify the parent record-type for binding the fields of the parent, but it seems not in Guile-3.0.
I know Guile-3 had tweaked record-type to unify the low-level implementation.

My question: Is this the new expected activity? Do we have to tweak all record type matching since Guile-3 ?
Or maybe it's just a bug?

Best regards.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]