<br>   Mark,<div><br></div><div>   The [] syntax for the labels will clash with the sequencing syntax we&#39;ve been discussing. Possibly {} or a unique separator:</div><div><br></div><div>{else1} A()</div><div><br></div><div>
else1 := A()</div><div><br></div><div>else1 ?= A()</div><div><br></div><div>   Considering that Patterns can also take bindings, probably {} is more distinct:</div><div><br></div><div>{else1} a : A()</div><div><br></div><div>
   My vote:</div><div><br></div><div>when<br>    {else1} Person( name == &quot;darth&quot; ) // works on patterns<br>    A()</div><div>    {else2} B()<br>then<br>   ....<br>otherwise.else1<br>...<br>otherwise.else2<br>...</div>
<div>end</div><div><br></div><div>   Will we support unlabeled &quot;else&quot; as well?</div><div><br></div><div>when</div><div>    A() and B()</div><div>then</div><div>   ...</div><div>otherwise</div><div>   ...</div><div>
end</div><div><br></div><div>   If so, what will be the semantics of it? What happens if an A() is inserted but not B()? vice-versa? What happens if C() is inserted?</div><div><br></div><div>   Regarding inline &quot;consequences&quot;, at the moment I am not really a fan of it. I think it complicates the syntax unnecessarily at this point but I can be convinced. The support to else by itself is a big step forward as you know users frequently ask for that.</div>
<div><br></div><div>   My .02c.</div><div><br></div><div>   Edson</div><div>   </div><div><br><div class="gmail_quote">2011/8/18 Mark Proctor <span dir="ltr">&lt;<a href="mailto:mproctor@codehaus.org">mproctor@codehaus.org</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">We have been looking into designs around else, so here are our initial<br>
brain storming ideas, which aims at doing more than just else, but<br>
handling signal processing like situations. &quot;else&quot; is always triggerd by<br>
the failure of a left propagation. In effect an named &quot;else&quot; block is<br>
just another terminal node that will result in an activation on the<br>
agenda. It will have access to declarations prior to the failure of<br>
propagation in the network.<br>
<br>
// Possible syntaxes<br>
[name] ( CE+ ) // no symbol<br>
[name] | ( CE+ )<br>
[name] &lt; ( CE+ )<br>
<br>
1)<br>
when<br>
     [name1] &lt; Person( name == &quot;darth&quot; ) // works on patterns<br>
     A()<br>
then<br>
    ....<br>
then.name1<br>
...<br>
end<br>
<br>
2)<br>
when<br>
     $p : Person( )<br>
     [name1] &lt; eval( $<a href="http://p.name" target="_blank">p.name</a> == &quot;darth&quot; ) // works on evals<br>
     A()<br>
then<br>
    ....<br>
then.name1<br>
...<br>
end<br>
<br>
3)<br>
when<br>
     [name1] &lt; ( Person( name == &quot;darth&quot; ) and Address( city == &quot;death<br>
star&quot; ) // works on groups<br>
     A()<br>
then<br>
    ....<br>
then.name1<br>
...<br>
end<br>
<br>
This could actuall be extended to have inline &quot;then&quot; too. In this case<br>
when their is a success propagation on that node it will result in an<br>
activation placed on the agenda that has access to all the prior bound<br>
declarations.<br>
<br>
1)<br>
when<br>
     Person( name == &quot;darth&quot; ) &gt; [name1]  // works on patterns<br>
     A()<br>
then<br>
    ....<br>
then.name1<br>
...<br>
end<br>
<br>
2)<br>
when<br>
     $p : Person( )<br>
     eval( $<a href="http://p.name" target="_blank">p.name</a> == &quot;darth&quot; ) &gt; [name1] // works on evals<br>
     A()<br>
then<br>
    ....<br>
then.name1<br>
...<br>
end<br>
<br>
3)<br>
when<br>
    ( Person( name == &quot;darth&quot; ) and Address( city == &quot;death star&quot; ) &gt;<br>
[name1]  // works on groups<br>
     A()<br>
then<br>
    ....<br>
then.name1<br>
...<br>
end<br>
<br>
This can be used with &#39;or&#39;<br>
when<br>
     ( A() &gt; [a1] or<br>
       B() &gt; [b1] or<br>
       C() &gt; [c1] )<br>
    D()<br>
then<br>
...<br>
then.a1<br>
....<br>
then.b1<br>
....<br>
then.c1<br>
...<br>
end<br>
<br>
It&#39;s a little tricker but in theory we can do this before/afer the &#39;or&#39; too<br>
This can be used with &#39;or&#39;<br>
when<br>
     [x1] &lt; ( A() &gt; [a1] or<br>
                  B() &gt; [b1] or<br>
                  C() &gt; [c1] )<br>
                  D()<br>
then<br>
...<br>
then.a1<br>
....<br>
then.b1<br>
....<br>
then.c1<br>
...<br>
then.x1<br>
....<br>
end<br>
<br>
We could allow [name] as just an inline creation to an activation that<br>
always passes, which with &#39;or&#39; could provide a &quot;default&quot;.<br>
when<br>
     [x1] &lt; ( A() &gt; [a1] or<br>
                  B() &gt; [b1] or<br>
                  C() &gt; [c1] or<br>
                   [default] )<br>
                  D()<br>
then<br>
<br>
Of course both could be supported at the same time<br>
[afailed] &lt; A() &gt; [asuccess]<br>
<br>
<br>
We could further allow just an inline code block, isntead of an inline<br>
reference to a block {...code here...} instead of [name1].<br>
<br>
We can also use this to do switch like operations, for erlang style<br>
signal processing, although i&#39;d like to see an improvemet to the syntax<br>
here, just not sure what it would be...<br>
$o : Object() from stream<br>
( A() &gt; [a] from $o or<br>
   B() &gt; [b] from $o or<br>
   C() &gt; [c] from $o )<br>
<br>
Where as &#39;or&#39; currently works like java&#39;s &quot;|&quot; single operator, i.e. all<br>
logical branches are tested. We could add a short cut or operationr<br>
&#39;sor&#39; that would work like &quot;||&quot;, so once the first CE matches in an &#39;or&#39;<br>
block the rest are igored. We could even consider an &#39;xor&#39; ....<br>
<br>
Finally there is no reason why we couldn&#39;t allow other CE&#39;s after the &lt;.<br>
Which would provide for very rich signal processing. For instance. If<br>
A() fails, it&#39;ll propagate to B, if B() fails it&#39;ll activate [a1]<br>
[a1] &lt; B() &lt; A()<br>
This can be nested and using using parenthesis to show groupings.<br>
( [a1] &lt; B() &gt; [b2] ) &lt; A()<br>
<br>
Anyway more food for thought, enjoy :)<br>
<br>
Mark<br>
<br>
<br>
<br>
_______________________________________________<br>
rules-dev mailing list<br>
<a href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>  Edson Tirelli<br>  JBoss Drools Core Development<br>  JBoss by Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>
</div>