As a design choice, should in Add(t1@Id("foo"), t2@Id("foo")) have <eq>(t1,t2) after analysis?

For two references to the same definition, this might be expected.

For two definitions in different scopes this might not be expected.

class Foo {
  public Int i;
}
class Bar {
  public Int i;
}

Should the "i" and the Field(Public(),Int(),"i") be <eq>, yes or no?

Once this is decided, it should be documented in the NaBL2 api.

(Current implementation uses attachments, so two ast-nodes are equal even if the ast-indices are not. Some future implementation might use attachments, which will make all nodes in the ast non-equal.)

Submitted by Daco Harkes on 2 February 2017 at 13:05

On 13 February 2017 at 15:32 Hendrik van Antwerpen commented:

It will work as follows:
- When comparing terms, either as ?(t,t) or <eq> (t1,t2), the AST positions don't matter.
- When indexing the AST, the code is not more carefull to prevent accidental sharing of nodes.
- If you want to reason about AST positions, you can use the *-ast-index strategies from the API.

For example, if you want to compare two terms taking ast indices into account, use nabl2-ast-eq.


On 13 February 2017 at 15:32 Hendrik van Antwerpen closed this issue.

Log in to post comments