unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Mark H Weaver <mhw@netris.org>
To: ludo@gnu.org (Ludovic Courtès)
Cc: guile-devel@gnu.org
Subject: Re: Functional record "setters", a different approach
Date: Fri, 09 Nov 2012 23:13:30 -0500	[thread overview]
Message-ID: <87a9uqrt79.fsf@tines.lan> (raw)
In-Reply-To: <87625fdi8p.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Thu, 08 Nov 2012 20:09:26 +0100")

Hi Ludovic,

ludo@gnu.org (Ludovic Courtès) writes:
> Mark H Weaver <mhw@netris.org> skribis:
>> +    (pass-if "set-fields with one path as a prefix of another"
>> +      (let ()
>> +        (define-immutable-record-type foo (make-foo x) foo?
>> +          (x foo-x)
>> +          (y foo-y set-foo-y)
>> +          (z foo-z set-foo-z))
>> +
>> +        (define-immutable-record-type :bar (make-bar i j) bar?
>> +          (i bar-i)
>> +          (j bar-j set-bar-j))
>> +
>> +        (catch 'syntax-error
>> +         (lambda ()
>> +           (compile '(let ((s (make-bar (make-foo 5) 2)))
>> +                       (set-fields s
>> +                         ((bar-i foo-x) 1)
>> +                         ((bar-i foo-z) 2)
>> +                         ((bar-i) 3)))
>> +                    #:env (current-module))
>> +           #f)
>> +         (lambda (key whom what src form subform)
>> +           (equal? (list key whom what form subform)
>> +                   '(syntax-error set-fields
>> +                                  "one field path is a prefix of another"
>> +                                  (set-fields s
>> +                                    ((bar-i foo-x) 1)
>> +                                    ((bar-i foo-z) 2)
>> +                                    ((bar-i) 3))
>> +                                  (bar-i)))))))))
>
> You might want to use ‘pass-if-equal’ here, for better reporting.

I see now what you meant, and I just pushed a patch to convert these to
use 'pass-if-equal'.

I also pushed a couple more patches to improve error reporting.

    Thanks!
      Mark



      parent reply	other threads:[~2012-11-10  4:13 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-11  6:59 Functional record "setters", a different approach Mark H Weaver
2012-04-11  7:57 ` Mark H Weaver
2012-04-11  8:20   ` Mark H Weaver
2012-04-11 22:27     ` Ludovic Courtès
2012-04-11 22:22 ` Ludovic Courtès
2012-04-12 15:04   ` Mark H Weaver
2012-04-12 16:45     ` Thien-Thi Nguyen
2012-04-12 19:58     ` Ludovic Courtès
2012-04-13  1:58       ` Mark H Weaver
2012-04-13 15:41         ` Ludovic Courtès
2012-04-13 17:26           ` Mark H Weaver
2012-05-07 16:34         ` Ludovic Courtès
2012-05-14 22:25           ` Mark H Weaver
2012-05-15 21:23             ` Ludovic Courtès
2012-11-07 20:04 ` Mark H Weaver
2012-11-08  5:15   ` Mark H Weaver
2012-11-08 19:09     ` Ludovic Courtès
2012-11-09  3:54       ` Mark H Weaver
2012-11-10 16:28         ` Ludovic Courtès
2012-11-10 19:03           ` Mark H Weaver
2012-11-10 21:40             ` Ludovic Courtès
2012-11-10  4:13       ` Mark H Weaver [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a9uqrt79.fsf@tines.lan \
    --to=mhw@netris.org \
    --cc=guile-devel@gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).