Re: more about object creation (ACTION-554)

</Chair>
Gary,

like Patrick (and probably for the same reasons :-), I prefer option A.

Gary Hallmark wrote:
> 
> Option A. 'new' [Var '#'] CLASS '[' (TERM '->' TERM)* ']'
> 
> e.g.
> Forall ?x ?z (Do(new ?z # _Z[_x->?x] new _Y[_z->?z]) :- ?x # _X)
> 
> The Var ?z must be declared somewhere, presumably in the enclosing 
> Forall.  What happens if the Var is also referenced in the rule condition?

However, I would prefer if we introduced a specific construct, modeled on the quantifiers, to identify local (or convenience) bindings. E.g. something like:

   Bind ::= 'Bind' Var Pattern (Formula)

allowing to write rules like (informally)

Forall ?employee (?employee # ex:Employee)
If (
    Bind ?salary (?employee[salary->?salary)
    And (?employee[name->"csma"] fun:numeric-less-than(?salary, 200,000))
    )
Then
   Bind ?salary (?employee[salary->?salary)
   Do(?employee[salary->fun:numeric-multiply(?salary, 1.1)])
  

(in which case the semantics I proposed for the "no-repeat" resolution strategy would work, because the repetition would be checked only wrt the binding of the "rule" variable ?employee).

Wrt the "New" construct, if the newly created object needs be reused in the action part of the same rule, it would be enclosed as the pattern in a Bind, and, if not, it would just be another action. Like (to use Gary's example):
   
Forall ?x (Bind ?z (new _Z[_x->?x]) Do(new _Y[_z->?z])) :- ?x # _X
                   |bind'g pattern|
                   |   for ?z     |
                                    |<- scope of ?z ->|
          |<------------------- scope of ?x --------------------->|

Christian
<Chair>

Received on Tuesday, 9 September 2008 14:50:01 UTC