From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Nala Ginrut Newsgroups: gmane.lisp.guile.devel Subject: The r6rs record-type in pattern matching of Guile-3.0 Date: Tue, 25 Aug 2020 04:16:08 +0800 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000007f01ba05ada54294" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35117"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Andy Wingo To: guile-devel Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Mon Aug 24 22:16:48 2020 Return-path: Envelope-to: guile-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kAItb-00091b-NA for guile-devel@m.gmane-mx.org; Mon, 24 Aug 2020 22:16:47 +0200 Original-Received: from localhost ([::1]:45848 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kAIta-00011A-LM for guile-devel@m.gmane-mx.org; Mon, 24 Aug 2020 16:16:46 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55576) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kAItG-0000zQ-2m for guile-devel@gnu.org; Mon, 24 Aug 2020 16:16:26 -0400 Original-Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]:44307) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kAItE-0005S4-G2 for guile-devel@gnu.org; Mon, 24 Aug 2020 16:16:25 -0400 Original-Received: by mail-lj1-x22e.google.com with SMTP id g6so11129634ljn.11 for ; Mon, 24 Aug 2020 13:16:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=KDGKJQC/7G3B5zFyXhDmyFZqANgUdzInsNl1p89EbuE=; b=Ddw9zA8cw+Y5vaxQlfY69QBfGyKhzSBzIBgNo+fRruQj4c6gkSGNUwERBSGhvKsiWX hfiRb3uyS9Vi+nQD8D6GA2JHPd243+2PxfV4t1IVvMMVfR5M/9kg0cnIMGVKESKRmB2Y 2OSyTlDBnWMVL2dAZvaTvJWGTXKqwoO+N2VfP3xbfciE1fHtLYwy9wl1bLJKGRiBRsDe w2O0KGZRL8yZXTGbJcVLoIKBLDtLrYcJlHHz/JnI5eZqyPwLEyi6sNnvUmrVOhQcTAlm /CBwtozHKBQ2x27+IWFbc2S8w40/5aCkuJEn+D2H/u3aXkSjwoEl3UFgdUzBJErN3x2f OuTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=KDGKJQC/7G3B5zFyXhDmyFZqANgUdzInsNl1p89EbuE=; b=eRlmTio62o6echxit/0cpv/DlbWQ1nzyiQyqJX9o7UUNwRNQ9kafacMIrFcLLCmAdv N0UEUV+u6YzYSkWgISOI/PDug+Bg0PMxsQujIiPH0ntDWA2Y8Wpv41RTjyaHKPb6bG/e haXxANm4kCPChpnQqOt8qGbe2fMraAzcXm2xUCKGpBZQyvYHSjdjjiFCwtUWaDq0W3SY GT2fDaXq5EBH/TTUe2xyP5BaoZcdKCo7ePvpcE9QZxWNGnf051WXGvUEze+mmrFN9uE1 oFdjcmjd6mwA7SbFb9DoxKwTtdU/HrhfS4G14mVx8D2SL1xDFzaxFz4JVqYWTkR35WG9 BhWQ== X-Gm-Message-State: AOAM532NtiyvnHHEti06IdgeLix7deSY6CKSaZLiVip9Sj5gB4sXalhX HHonCFsyB4PPIx/4GhqdSaCcEXf0mksapNaqNcOosAO6BzhOnA== X-Google-Smtp-Source: ABdhPJzvRmy1PyhwUKOa1kX1XMeHN6qqKNf1RwvpSvbPz4jpDExm5wtJ7cyCj/By3HiarArMZZ8kI5FshHzhQoMyJLA= X-Received: by 2002:a2e:b5d6:: with SMTP id g22mr3501169ljn.252.1598300180380; Mon, 24 Aug 2020 13:16:20 -0700 (PDT) Received-SPF: pass client-ip=2a00:1450:4864:20::22e; envelope-from=nalaginrut@gmail.com; helo=mail-lj1-x22e.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.io gmane.lisp.guile.devel:20579 Archived-At: --0000000000007f01ba05ada54294 Content-Type: text/plain; charset="UTF-8" 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 ==> ( 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. --0000000000007f01ba05ada54294 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi folks!
I found the r6rs record pattern m= atching has different results compared to Guile-2.
Here is the ex= ample 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
=C2=A0 (($ bbb ($ aaa _ a) = b) (list a b))
=C2=A0 (else "no"))
;; =3D=3D&= gt; "no"=C2=A0 in Guile-3
;; =3D=3D=3D> (1 2) in Gui= le-2

(match r
=C2=A0 (($ bbb a b) (lis= t a b))
=C2=A0 (else "no"))
=3D=3D> (1 2)= =C2=A0 in Guile-3
=3D=3D> (<aaa> 2) in Guile-2
=
--------------------------------------------end-----------------------= -----------------------

In Guile-2, we have to spe= cify the parent record-type for binding the fields of the parent, but it se= ems not in Guile-3.0.
I know Guile-3 had tweaked record-type to u= nify the low-level implementation.

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

Best regards.

--0000000000007f01ba05ada54294--