Summary
record types of the same name are treated equal
Metadata
- Id: a13503848513b2a40ac0a473288a976280dee21f
- Trac id: 500
- Type: defect
- Reporter: syn
- Owner:
- Cc:
- Status: closed
- Component: core libraries
- Estimated difficulty:
- Resolution: wontfix
- Priority: major
- Milestone: 4.9.0
- Version: 4.6.x
- Changetime: 2012-09-24 21:47:48 UTC
- Created: 2011-02-13 15:17:16 UTC
- Keywords:
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.
Changes and comments
[2011-02-13 20:29:44 UTC] sjamaan wrote:
This problem was mentioned by zbigniew too. There was a brief period that this was fixed, but this caused other troubles, see #392
[2011-02-14 02:20:54 UTC] zbigniew changed status from new to closed
[2011-02-14 02:20:54 UTC] zbigniew set resolution to wontfix
[2011-02-14 02:20:54 UTC] zbigniew wrote:
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)))
[2011-02-14 23:02:45 UTC] syn wrote:
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!
[2011-06-01 09:00:41 UTC] felix changed milestone from 4.7.0 to 4.8.0
[2011-06-01 09:00:41 UTC] felix wrote:
Milestone 4.7.0 deleted
[2012-09-24 21:47:48 UTC] felix changed milestone from 4.8.0 to 4.9.0
[2012-09-24 21:47:48 UTC] felix wrote:
Milestone 4.8.0 deleted