Child rules can see a parent's rule inputs - is this expected behavior?

I was going through someone else's code at my company and found a puzzling thing.  There was a parent expression rule calling a child expression rule.  The child expression rule referenced a rule input that it did not have defined.  The parent rule did have that rule input defined, and the child rule was able to access the rule input defined only in the parent.

I want to make it clear that I believe the child rule *should* have had a rule input defined, and that the input should have been explicitly passed by the parent rule.  The situation I ran into is not something I would personally rely on or a best practice I would recommend.

Is this behavior intentional?  Just curious.

Below is a simple example:

The parent rule has one rule input of a CDT "Widget" which has field1, field2, field3.  ri!widget of type Widget is defined on expression rule "parentRule".

contents of parentRule



childRule has *no* rule inputs.

contents of childRule


When I execute parentRule, I get back the contents of the widget rule input.  If I tried to execute the childRule by itself, it complains that it does not recognize the ri!widget variable, but executing from the parent it all works.

  Discussion posts and replies are publicly visible