Skip to content

Shadowing #150

Open
Open
@sharkdp

Description

@sharkdp

It would probably be beneficial if function parameters could shadow definitions from outer scopes, even unit names. For example:

>>> fn area(h: Length, w: Length) -> Area = h × w
error: identifier clash in definition
    ┌─ Module 'units::si', File /usr/share/numbat/modules/units/si.nbt:126:6
    │
126 │ unit hour: Time = 60 minutes
    │      ---- Previously defined here
    │
    ┌─ <input:1>:1:9
    │
  1 │ fn area(h: Length, w: Length) -> Area = h × w
    │         ^ identifier is already in use

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions