Submitted by Gabriël Konat on 3 May 2013 at 13:35

On 3 May 2013 at 13:41 Gabriël Konat tagged error

On 7 May 2013 at 15:53 Gabriël Konat commented:

@guwac: Does the generator support implicit definitions yet?


On 7 May 2013 at 17:14 Guido Wachsmuth commented:

Yes it does. In C#, the following binding rule

Class(x, m*) :
  defines 
    unique Class x 
    of type Type(x)
  scopes Field, Function
  implicitly defines 
    Field "this" 
    of type Type(x)
    in m*

generates the following Stratego rules:

nabl-scoping-site =
  ?Class(x, m*)
  ; Class(
      id
    , nabl-scope(|[NablNsField()])
    )

nabl-def-site(child-uris__, sibl-uris__, implicits__|lang__, partition__, uniques__, uri__, states__) =
  ?Class(x, m*)
  ; Class(
      nabl-def(
        ?c-uri1__
      , ?s-uri1__
      | lang__
      , partition__
      , uniques__
      , uri__
      , uri__
      , NablNsClass()
      , Unique()
      , Current()
      , [NablNsField(), NablNsFunction()]
      )
    , id
    )
  ; where(i-2__ := <nabl-def(
                      ?c-uri2__
                    , ?s-uri2__
                    | lang__
                    , partition__
                    , uniques__
                    , c-uri1__
                    , s-uri1__
                    , NablNsField()
                    , Unique()
                    , [DefScope(m*)]
                    , []
                    )> "this")
  ; match(child-uris__|c-uri2__)
  ; match(sibl-uris__|s-uri2__)
  ; match(implicits__|[i-2__])

nabl-prop-site(|lang__, partition__, states__, implicits__) =
  ?Class(x, m*)
  ; [i-2__] := implicits__
  ; Class(
      nabl-props(
      | partition__
      , [ Prop(
            Type()
          , Type(x)
          , []
          )
        ]
      )
    , id
    )
  ; where(<nabl-props(
           | partition__
           , [ Prop(
                 Type()
               , Type(x)
               , []
               )
             ]
           )> i-2__)

nabl-import-site(|lang__, partition__, uris__, states__) =
  ?Class(x, m*)
  ; nabl-import(
    | lang__
    , partition__
    , uris__
    , [ Single(
          "this"
        , [DefScope(m*)]
        , []
        )
      ]
    )

Handling external definitions with imports might not be the right way here. But that should not be the issue in the master-working branch.


On 7 May 2013 at 17:38 Guido Wachsmuth commented:

I changed it. External definitions are aliased in nabl-def again, not in nabl-import.


On 7 May 2013 at 19:08 Eelco Visser commented:

The issue is not external definitions, but binding this to its enclosing entity definition.


On 7 May 2013 at 23:06 Guido Wachsmuth commented:

Should it really bind to it, i.e. do you like to ctrl+click this and jump to the entity? The current idea was to define a field this implicitly, which is of the type of the enclosing entity. You cannot ctrl+click this then, because there is no place to jump to. But you can still resolve to the implicit field and get its type.


On 16 June 2013 at 16:14 Gabriël Konat closed this issue.

Log in to post comments