Re: Functional record setters, a different approach

2012-11-10 Thread Ludovic Courtès
Hello! Documentation attached. Comments? BTW, why does ‘set-field’ has the record as its 2nd argument instead of 1st (unlike ‘set-fields’)? Thanks, Ludo’. From f7877d47009dc85e74bc63fd562b77f552a54bd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= l...@gnu.org Date: Sat, 10

Re: Functional record setters, a different approach

2012-11-10 Thread Mark H Weaver
Hi Ludovic, l...@gnu.org (Ludovic Courtès) writes: Documentation attached. Comments? Thanks! Looks good to me, modulo a few comments below. BTW, why does ‘set-field’ has the record as its 2nd argument instead of 1st (unlike ‘set-fields’)? Good question. I followed the syntax of

Re: Functional record setters, a different approach

2012-11-10 Thread Ludovic Courtès
Mark H Weaver m...@netris.org skribis: l...@gnu.org (Ludovic Courtès) writes: [...] BTW, why does ‘set-field’ has the record as its 2nd argument instead of 1st (unlike ‘set-fields’)? Good question. I followed the syntax of 'set-field' from your original patch, but that argument order did

Re: Functional record setters, a different approach

2012-11-09 Thread Mark H Weaver
Hi Ludovic, l...@gnu.org (Ludovic Courtès) writes: Mark H Weaver m...@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) +

Re: Functional record setters, a different approach

2012-11-08 Thread Ludovic Courtès
Hi Mark! Mark H Weaver m...@netris.org skribis: I've attached a slightly improved functional record setters patch. The only change since yesterday's version is to the test suite, which now includes tests of the compile-time error checking. Nice, thanks! It addresses my main concern with the

Re: Functional record setters, a different approach

2012-11-08 Thread Mark H Weaver
Hi Ludovic! l...@gnu.org (Ludovic Courtès) writes: At the time you were concerned about the “weight” of these macros. Are you just more relaxed now, or do you have a psyntax optimization in the pipeline? :-) I did some experiments, and on my 64-bit system this patch increases the bytecode

Re: Functional record setters, a different approach

2012-11-07 Thread Mark H Weaver
Hello all, Apologies for the long delay on this, but I've finally produced an improved implementation of functional record setters for stable-2.0. It is fully compatible with the earlier API proposed by Ludovic in http://lists.gnu.org/archive/html/guile-devel/2012-04/msg00032.html (i.e.

Re: Functional record setters, a different approach

2012-11-07 Thread Mark H Weaver
Hello all, I've attached a slightly improved functional record setters patch. The only change since yesterday's version is to the test suite, which now includes tests of the compile-time error checking. Here's a brief overview of the provided functionality. First, 'define-immutable-record-type'

Re: Functional record setters, a different approach

2012-05-15 Thread Ludovic Courtès
Hi Mark, Mark H Weaver m...@netris.org skribis: l...@gnu.org (Ludovic Courtès) writes: Mark H Weaver m...@netris.org skribis: l...@gnu.org (Ludovic Courtès) writes: I’ll let you see whether/how you can borrow from this in your code, if that’s fine with you. Okay, will do. Any progress

Re: Functional record setters, a different approach

2012-05-07 Thread Ludovic Courtès
Hi Mark! Mark H Weaver m...@netris.org skribis: l...@gnu.org (Ludovic Courtès) writes: I’ll let you see whether/how you can borrow from this in your code, if that’s fine with you. Okay, will do. Any progress on this? ;-) I’m happy to help with updating the docs, for instance, if you

Re: Functional record setters, a different approach

2012-04-13 Thread Ludovic Courtès
Hi Mark! And Happy Friday, as our friend would say. :-) Mark H Weaver m...@netris.org skribis: l...@gnu.org (Ludovic Courtès) writes: Mark H Weaver m...@netris.org skribis: l...@gnu.org (Ludovic Courtès) writes: I’d still want named single-field setters, for convenience. For that, we

Re: Functional record setters, a different approach

2012-04-13 Thread Mark H Weaver
Hi Ludovic! l...@gnu.org (Ludovic Courtès) writes: I’d say ‘set-fields’, no? Okay, good enough. Would these checks be alleviated by Andy’s work on peval “predicates”? Unfortunately, no. The 'vtable' field of a struct is a mutable field, and in fact when a GOOPS class is redefined, the

Re: Functional record setters, a different approach

2012-04-12 Thread Mark H Weaver
Hi Ludovic! l...@gnu.org (Ludovic Courtès) writes: Mark H Weaver m...@netris.org skribis: The public interface I've created is quite a bit different than what we've been discussing so far. I'm open to changing it, but here's what the attached patch currently exports from (srfi srfi-9 gnu):

Re: Functional record setters, a different approach

2012-04-12 Thread Thien-Thi Nguyen
() Mark H Weaver m...@netris.org () Thu, 12 Apr 2012 11:04:13 -0400 However, I find the term 'set' misleading, since no mutation is taking place. Maybe 'update'? I dunno, I don't have strong feelings on this. How about ‘overlay’ (or ‘over-set’ or ‘mask’) or ‘interpose’ or ‘insinuate’

Re: Functional record setters, a different approach

2012-04-12 Thread Ludovic Courtès
Hi Mark! Mark H Weaver m...@netris.org skribis: l...@gnu.org (Ludovic Courtès) writes: Mark H Weaver m...@netris.org skribis: The public interface I've created is quite a bit different than what we've been discussing so far. I'm open to changing it, but here's what the attached patch

Re: Functional record setters, a different approach

2012-04-12 Thread Mark H Weaver
Hi Ludovic! l...@gnu.org (Ludovic Courtès) writes: Mark H Weaver m...@netris.org skribis: l...@gnu.org (Ludovic Courtès) writes: I’d still want named single-field setters, for convenience. For that, we probably still need a separate ‘define-immutable-record-type’. Agreed. Cool! Could

Re: Functional record setters, a different approach

2012-04-11 Thread Mark H Weaver
I rushed out my last email because I didn't want anyone else to waste time working on the same functionality. Needless to say, this is very preliminary work. A few errata in my last email: (define-tagged-inlinable (key value) ... (name formals ...) body ...) There's a missing pair of parens

Re: Functional record setters, a different approach

2012-04-11 Thread Mark H Weaver
I wrote: I rushed out my last email because I didn't want anyone else to waste time working on the same functionality. More importantly, I just realized that the patch I sent out included only part of my changes. It was missing my initial work to clean up the srfi-9 code before I started

Re: Functional record setters, a different approach

2012-04-11 Thread Ludovic Courtès
Mark H Weaver m...@netris.org skribis: +((_ check? struct-expr ((getter . rest) expr) ...) + ;; + ;; FIXME: Improve compile-time error reporting: + ;; 1. report an error if any getter-path is a + ;; prefix of any other getter-path. + ;;