#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: |
Description
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 14 years ago by
comment:2 Changed 14 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
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 14 years ago by
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!
This problem was mentioned by zbigniew too. There was a brief period that this was fixed, but this caused other troubles, see #392