Name conflicts between “defines unique” and “imports” aren’t detected as errors. For example, starting with the example project and adding:


    Definition.EntityExtension = <
        entity <ID> extends <ID> {
            <{Property "\n"}*>

EntityExtension(x, y, _) :
    defines Entity x 
        of type Type(x)
    refers to Entity y
    scopes Property
    imports Property from Entity y

No redefinition error occurs when an imported property is redefined:

entity BlogPosting {
  poster : User
  body   : String

entity BlogPostingX extends BlogPosting {
  body   : String
Submitted by Peter S. Housel on 2 January 2015 at 23:45

On 2 January 2015 at 23:51 Eelco Visser commented:

The rule is that local definitions shadow imported definitions. Thus the body of BlogPostingX overrides that of BlogPosting. This exactly what one would expect from inheritance in an OO language.

On 3 January 2015 at 00:50 Peter S. Housel commented:

(Removing the superfluous “refers to Entity y” doesn’t change anything.)

On 3 January 2015 at 01:06 Peter S. Housel commented:

If I want to prevent this sort of shadowing of imports is there any way of doing so within the NaBL language, or would I have to implement additional semantic checks in Stratego?

On 7 January 2015 at 10:52 Gabriël Konat commented:

This has to be implemented as a constraint in Stratego. See and for information on how to do this.

Since you are working with imports, you will want to use the nabl-lookup-local-import(|ctx) and nabl-lookup-lexical-import(|ctx) variants that take imports into account.

Log in to post comments