Skip to content

Spec is unclear on label shadowing #1572

@tomstuart

Description

@tomstuart

As discussed in #210 and #303, it’s not clear from the spec whether a nested block may redefine (“shadow”) a label from one of its ancestors, although the test introduced by #216 makes it unambiguous that this is allowed in practice.

Subjectively, I got the impression from reading the spec that label shadowing is explicitly not allowed, because:

  1. the production which synthesises an updated identifier context for labels has a side condition which prevents the use of any identifier which already appears in the labels index space of the current context; and
  2. well-formedness of identifier contexts prevents duplicate identifiers in all index spaces.

I can explain away point 2 by noting that — itself somewhat counterintuitively — well-formedness appears to be asserted only selectively, i.e. in special circumstances where we expect the labels index space to be empty anyway, but I have no explanation for point 1.

It’s entirely possible I’ve misunderstood the spec, but either way, might it be clarified to make the situation more explicit?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions