Opened 6 years ago
Last modified 14 months ago
#1513 assigned defect
Type declarations in modules do not namespace structs
Reported by: | sjamaan | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | someday |
Component: | core libraries | Version: | 5.0.0 |
Keywords: | Cc: | ||
Estimated difficulty: | easy |
Description
As reported by Jörg Wittenberger, the following program gives a compilation warning in CHICKEN 5 but not in CHICKEN 4:
(module foo * (import scheme) (cond-expand (chicken-5 (import (chicken base) (chicken type) )) (else (import chicken))) (: make-foo (string --> (struct foo))) (define-record foo bar) )
Presumably this is because the low-level name of the struct is foo#foo
here (because we're inside a module). I think the correct fix for this would be to look at struct identifiers, and when unqualified, just prefix it.
Change History (14)
comment:1 Changed 6 years ago by
comment:2 Changed 6 years ago by
I think making just making unqualified struct identifiers proper supertypes of qualified identifiers would work. So saying foo
is ((struct foo) -> *)
is saying foo
can take any struct foo, from any module.
comment:3 Changed 6 years ago by
The best thing to do for 5.0 is probably just to strip namespaces from the ##sys#make-structure
specialisation.
We can revisit and hopefully improve on this in 5.1 (or later).
comment:5 Changed 6 years ago by
Version: | 5.0 → 5.0.0rc1 |
---|
comment:6 Changed 6 years ago by
Fixed with a workaround, for the time being, in 55bb90510bea0bb7618193f2797e30f2207a41b7.
comment:8 Changed 6 years ago by
Owner: | evhan deleted |
---|
comment:9 Changed 6 years ago by
Version: | 5.0.0rc1 → 5.0.0 |
---|
comment:10 Changed 6 years ago by
Version: | 5.0.0 → 5.0 |
---|
comment:11 Changed 6 years ago by
Milestone: | 5.1 → 5.2 |
---|
comment:12 Changed 5 years ago by
Milestone: | 5.2 → 5.3 |
---|
comment:13 Changed 4 years ago by
Milestone: | 5.3 → 5.4 |
---|
comment:14 Changed 14 months ago by
Milestone: | 5.4 → someday |
---|
Say, you're writing a module that uses struct
sfoo
from modulefoo
and structsbar
from modulebar
. Then you define a functionfoobar
and annotate it with type((struct foo) (struct bar) -> *)
. I'm pretty sure we don't currently have the information to correctly qualify the struct names in this type.