All,

 

Given the following rule:

 

rule "Add ABC123 Feature"

      when

            not MyFeature(testCD == "ABC123")

            UserRequest(someValue == "ABC123_FEATURE")

            $eligible : FeatureEligible(testCD == "ABC123")

      then

            insert(new MyFeature($eligible));        

end

 

I’d like to create a DSL.   Notice that “testCD” is the same value.   

 

Is it possible to apply a value captured in a DSL and use it in more than one condition?    In the above scenario we want to see if the user is eligible for the feature ABC123, and check whether or not that feature has already been added in working memory.

 

The DSL version of the rule might look something like:
rule "Add ABC123 Feature"

      when

          User is eligible for "ABC123"

          User requests "ABC123_FEATURE"

      then

            Add feature      

end

 

Would I need to write the DSL for the “ABC123” piece like this?

[when]User is eligible for “{testCD}”=not MyFeature(testCD == “{testCD}”)   $eligible : FeatureEligible(testCD = “{testCD}”)
 
Or will I always need to create 2 statements? 
 
What are the performance implications of using a DSL?  Is there extra overhead at runtime or does all the interpretation occur at rule compilation?
 
Thanks!
Macon