agentm / agentm/project-m36

prevent With clause name shadowing

Offen
#359 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Haskell
Sterne
952
Forks
50
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Name shadowing can be quite a footgun. Example:

```
TutorialD (master/main): x:=with (x as true) x
("with type",Relation (attributesFromList []) (RelationTupleSet {asList = []}))
("with type",Relation (attributesFromList []) (RelationTupleSet {asList = []}))
TutorialD (master/main): :showexpr x
ERR: RelVarAlreadyDefinedError "x"
```

The original expression should almost certainly be rejected, but the relational expression validation is sound, so we would need to check that the new relvarname "x" is not mentioned in the with clause names.

I am toying with the idea of preventing name shadowing of relvars or other with clause macro names (even macros shadowing macros). It does seem that name shadowing can be sometimes useful when moving subexpressions around, but the risk and cost of mistakes here is very high.

Any objection?

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.