Open
Description
Currently (on master
, anyway), the following program compiles:
data Foo:
| bar(x)
end
Foo = bar(1)
Then, in the REPL, the following is possible:
> Foo
bar(1)
> a :: Foo = bar(2)
> a
bar(2)
In other words, Foo
is now bound in the value and module namespaces at the same time. Shouldn't this be a shadowing error? In terms of pedagogy, it seems like we wouldn't want to explain that "this name means two disjoint things at the same time." My inclination is to update resolve-scope
to maintain a separate 'unified' namespace to handle shadowing errors. Does this seem reasonable?
See Also:
data Foo
should not provideFoo
as a function #571 (removal ofFoo
as a function defined bydata:
)- Fix Module-Providing Semantics #1009 (similar namespacing issue, with modules)