Let the following NaBL entry:

  Arg([arg], t):
    defines
      Variable arg
        of type t
        of graph g
        of isinarg isin
      where
        t has graph g
        and arg has isinarg isin

If the Stratego rule create-isinarg-task(|ctx) fails (Stratego failure) when applied to arg then Variable arg is defined but it has no properties. This silent failure is typically hard to identify and debug. The generated code for the prop-site is:

  nabl-prop-site(|lang__, partition__, uris__, states__, implicits__) =
    ?Arg([arg], t)
    ; (where(r4-1-1__ := <get-or-create-property-task(|partition__, NablProp_graph())> t)
       ; where(r4-1-2__ := <get-or-create-property-task(|partition__, NablProp_isinarg())> arg)
       ; Arg(
           [ nabl-store-props(
             | partition__
             , [ Prop(
                   Type()
                 , t
                 , [r4-1-2__, r4-1-1__]
                 )
               , Prop(
                   NablProp_graph()
                 , r4-1-1__
                 , [r4-1-2__, r4-1-1__]
                 )
               , Prop(
                   NablProp_isinarg()
                 , r4-1-2__
                 , [r4-1-2__, r4-1-1__]
                 )
               ]
             )
           ]
         , id
         ))
    ; fail

What happens is that the second where clause fails, causing the entire rule to fail before any properties are stored. I suggest to make this failure explicit and hard. Either by wrapping the call to get-or-create-property-task in a with, example:

  nabl-prop-site(|lang__, partition__, uris__, states__, implicits__) =
    ?Arg([arg], t)
    ; (where(r4-1-1__ := <with(get-or-create-property-task(|partition__, NablProp_graph()))> t)
       ; where(r4-1-2__ := <with(get-or-create-property-task(|partition__, NablProp_isinarg()))> arg)
       ; Arg(
           [ nabl-store-props(
             | partition__
             , [ Prop(
                   Type()
                 , t
                 , [r4-1-2__, r4-1-1__]
                 )
               , Prop(
                   NablProp_graph()
                 , r4-1-1__
                 , [r4-1-2__, r4-1-1__]
                 )
               , Prop(
                   NablProp_isinarg()
                 , r4-1-2__
                 , [r4-1-2__, r4-1-1__]
                 )
               ]
             )
           ]
         , id
         ))
    ; fail

Or by defining a new strategy for creating tasks:

	must-get-or-create-property-task(|partition, property) =
	  get-or-create-property-task(|partition, property) <+ fatal-err(|$[Create [property] task failed for: ]); fail

And calling this instead. This will at least create a log of what is going on.

Submitted by Vlad Vergu on 15 January 2014 at 15:24

On 18 January 2014 at 23:17 Guido Wachsmuth commented:

I changed get-or-create-property-task to never fail. If there is no corresponding creation rule, a failure task is created. Additionally, an error message is connected to this failure task. The failure task prevents transitive issues. The error message reports the missing creation rule.


On 18 January 2014 at 23:17 Guido Wachsmuth closed this issue.

Log in to post comments