Skip to content

Namespacing and Shadowing #1010

Open
Open
@peblair

Description

@peblair

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:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions