chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] [ANN] SRFI-99 record types for CHICKEN


From: Thomas Chust
Subject: Re: [Chicken-users] [ANN] SRFI-99 record types for CHICKEN
Date: Thu, 8 Sep 2011 07:34:25 +0200

2011/9/8 John Cowan <address@hidden>:
> [...]
> Bug report:  A constructor defined to take explicit arguments does
> not work: instead of returning the instance, it returns a procedure
> that takes N arguments and ignores them,
> [...]

Hello John,

that's strange, I can't reproduce the problem here, everything looks
fine in this respect (note that rtd-constructor is *supposed* to
return a constructor procedure, not an instance, according to
specification):

  $ csi -R srfi-99

  CHICKEN
  (c)2008-2011 The Chicken Team
  (c)2000-2007 Felix L. Winkelmann
  Version 4.7.3 ((no branch)) (rev 5bbf21f)
  linux-unix-gnu-x86-64 [ 64bit manyargs dload ptables ]
  compiled 2011-08-17 on hd-t1179cl (Linux)

  ; [... snip ...]
  #;1> (define-record-type t #t #t x y z)
  #;2> ,d (make-t 1 2 3)
  structure of type `t226':
   0: 1
   1: 2
   2: 3
  #;2> ,d ((rtd-constructor t '#(y)) 2)
  structure of type `t226':
   0: #<unspecified>
   1: 2
   2: #<unspecified>

> [...]
> API suggestion: add redefine-record-type, which is the same as
> define-record-type except that instead of a gensym'd uid it uses the
> record name as the uid.
> [...]

You can always do that by explicitly specifying the uid, for example
like this:

  (define-record-type (foo #f #:uid 'foo) #t #t x y z)

I'm not sure this warrants a specialized macro.

> [...]
> Implementation suggestion: rather than storing the uid-to-rtd mapping in
> a global hash table, store it on the property list of the uid under the
> the key 'srfi-99.
> [...]

Sounds like a really good idea! The implementation will have to
wait for a few days, though, while I'm out of hacking mode and on a
bike tour :-)

Ciao,
Thomas


-- 
When C++ is your hammer, every problem looks like your thumb.



reply via email to

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