Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#500 closed defect (wontfix)

record types of the same name are treated equal

Reported by: Moritz Heidkamp Owned by:
Priority: major Milestone: 4.9.0
Component: core libraries Version: 4.6.x
Keywords: Cc:
Estimated difficulty:


Defining record types of the same name in two different modules are treated by Chicken as if they were the same. Example:

 (module a 
   (make-foo foo?)
   (import chicken scheme)
   (define-record foo))

 (module b
   (make-foo foo?)
   (import chicken scheme)
   (define-record foo))

 (import (prefix a a:) (prefix b b:))

 (print (a:foo? (b:make-foo)))

Prints #t but I think these should be treated as two separate types.

Change History (5)

comment:1 Changed 13 years ago by sjamaan

This problem was mentioned by zbigniew too. There was a brief period that this was fixed, but this caused other troubles, see #392

comment:2 Changed 13 years ago by Jim Ursetto

Resolution: wontfix
Status: newclosed

Yeah. Normal fix for this is to make your record names unambiguous or, better, use define-record-type and prefix the record name with your module name, while using short accessors. This eliminates most potential conflict. E.g. below you have (a:make-foo) but a:foo? only works for #<a-foo> not #<b-foo> nor #<kung-foo>.

(module a
 (define-record-type a-foo
   (make-foo x y) foo? (x foo-x) (y foo-y)))  

comment:3 Changed 13 years ago by Moritz Heidkamp

I don't really know what record-variants is for or how it works so I can't suggest a better solution than the one that has been tried and found to fail already. I guess we have to live with zbigniew's suggested work-around then for now. Thanks!

comment:4 Changed 13 years ago by felix winkelmann


Milestone 4.7.0 deleted

comment:5 Changed 12 years ago by felix winkelmann


Milestone 4.8.0 deleted

Note: See TracTickets for help on using tickets.