R6RS versus the pattern operators
John Cowan
(17 Aug 2020 12:55 UTC)
|
||
Re: R6RS versus the pattern operators
Marc Nieper-Wißkirchen
(17 Aug 2020 13:15 UTC)
|
||
(missing)
|
||
Fwd: R6RS versus the pattern operators
John Cowan
(17 Aug 2020 13:38 UTC)
|
||
Re: R6RS versus the pattern operators
Marc Nieper-Wißkirchen
(17 Aug 2020 13:48 UTC)
|
||
Re: R6RS versus the pattern operators
John Cowan
(17 Aug 2020 14:59 UTC)
|
||
Re: R6RS versus the pattern operators
Marc Nieper-Wißkirchen
(17 Aug 2020 15:27 UTC)
|
||
Re: R6RS versus the pattern operators
John Cowan
(17 Aug 2020 15:48 UTC)
|
||
Re: R6RS versus the pattern operators
Marc Nieper-Wißkirchen
(17 Aug 2020 15:53 UTC)
|
||
Re: R6RS versus the pattern operators
John Cowan
(17 Aug 2020 17:03 UTC)
|
||
Re: R6RS versus the pattern operators
Shiro Kawai
(17 Aug 2020 17:21 UTC)
|
||
Re: R6RS versus the pattern operators
Shiro Kawai
(17 Aug 2020 20:21 UTC)
|
||
Re: R6RS versus the pattern operators
Felix Thibault
(17 Aug 2020 22:22 UTC)
|
||
Re: R6RS versus the pattern operators
Shiro Kawai
(17 Aug 2020 22:35 UTC)
|
||
Re: R6RS versus the pattern operators
Marc Nieper-Wißkirchen
(18 Aug 2020 05:55 UTC)
|
||
(missing)
|
||
(missing)
|
||
Re: R6RS versus the pattern operators Marc Nieper-Wißkirchen (24 Aug 2020 14:02 UTC)
|
||
Re: R6RS versus the pattern operators
Felix Thibault
(27 Aug 2020 00:45 UTC)
|
||
Re: R6RS versus the pattern operators
Marc Nieper-Wißkirchen
(27 Aug 2020 07:50 UTC)
|
||
Re: R6RS versus the pattern operators
Lassi Kortela
(17 Aug 2020 13:52 UTC)
|
||
Re: R6RS versus the pattern operators
Adam Nelson
(17 Aug 2020 14:41 UTC)
|
Here is an example, you can use for experimentation: (define *counter* 0) (define-syntax define-record-type/id (syntax-rules () ((_ rtd (cname . name*) pred? get-id . field*) (begin (define-record-type rtd (%cname id . name*) pred? (id get-id) . field*)) (define (cname . arg*) (let ((id *counter*)) (set! *counter (+ 1 *counter*)) (apply %cname id arg*))))))) (define-record-type/id (make-record id) record? get-id (id record-id)) ;This record type has two fields, whose symbol names are both "id". Marc Am Fr., 21. Aug. 2020 um 08:11 Uhr schrieb Marc Nieper-Wißkirchen <xxxxxx@nieper-wisskirchen.de>: > > > > Felix Thibault <xxxxxx@gmail.com> schrieb am Fr., 21. Aug. 2020, 00:25: >> >> I've skimmed over SRFI-150 and I will come back to it but I am still not clear on the problem (record fields having equal symbolic names). I'm assuming the solution you are talking about would look like: >> >> (define-record-type <value> >> (make-value v) >> value? >> (v value-v)) >> >> (match (make-value 7) ((@ <value> (value-v v)) v)) >> >> instead of >> >> (match (make-value 7) ((@ <value> (v v)) v)) > > > Yes. Implementations like Chibi allow hygienically renamed field identifiers, which is the right thing for R7RS. > > I am away over the weekend but can assist you with details next week if needed. > > Marc > >> >> On Tue, Aug 18, 2020 at 1:55 AM Marc Nieper-Wißkirchen <xxxxxx@nieper-wisskirchen.de> wrote: >>> >>> Am Di., 18. Aug. 2020 um 00:22 Uhr schrieb Felix Thibault <xxxxxx@gmail.com>: >>> >>>> STklos also has records built on it's object system, and (unlike Gauche) the order of (class-slots rtd) isn't meaningful. So I've been thinking of struct as making sense for positional access (like Guile's structs), and object as making sense for by-name access, since those seem like the preferred ways to access for structs and objects. >>> >>> >>> Could we also improve the situation for R7RS records with hygienic instead of symbol field names? (The identifiers identifying the record fields in SRFI 9 may be hygienically renamed through macro instantiation and may thus have equal symbolic names while still being different.) >>> >>> For R7RS records, positional access makes perfect sense. For named access, symbolic names won't work in all cases (due to possible renaming), but we could, in principle, specify that the getters of the record type (which are unambiguous) serve in SRFI 204 as named labels for the record fields.