Ticket #323 (new enhancement)
Type names and function names should be in disjoint namespaces.
| Reported by: | jdn | Owned by: | sukyoungryu |
|---|---|---|---|
| Priority: | critical | Milestone: | |
| Component: | language change | Version: | |
| Keywords: | Cc: |
Description
This ticket is actually against a number of issues that the following example shows:
trait Element
end
Element(a:ZZ32):Element = Element(a, 0, 0)
Element(a:ZZ32, b:ZZ32):Element = Element(a, b, 0)
Element(a:ZZ32, b:ZZ32, c:ZZ32):Element = do
(MyImplementationDetail(a,b,c) asif Element)
end
object MyImplementationDetail(a, b, c) extends { Element } end
The first and probably easily understandable issue is that the code gives this error: Attempt to extend object type Element, saw Local@0/0 Which is not true, because Element is a trait and not an object. Also, Local@0/0 looks like an empty span of some sort.
The second and more serious issue is a proposal for language change. Type names and function names should be in disjoint namespaces.
Consider the situation where we want to do some computation on the creation of the object called MyImplementationDetail , then we define the toplevel function Element(a:ZZ32, b:ZZ32, c:ZZ32) and MyImplementationDetail now becomes an implementation detail. The user of this component should never be aware of the existance of MyImplementationDetail . However the return type of the overloaded Element functions becomes MyImplementationDetail , which exposes information about the implementation. To change that I would like to define the trait Element which is used as return type in the example above. However that is not possible: Attempt to extend object type Element, saw Local@0/0 .

