more about object creation (ACTION-554)

At today's telecon we discussed object creation.  Christian and Patrick 
wonder how one obtains a reference to the new object.  I.e. how to 
support the following use case (expressed in FLD):

Forall ?x (Exists ?y ?z And(?y # _Y ?z # _Z ?y[_z->?z] ?z[_x->?x]) :- ?x 
# _X)

The proposed syntax

'new' CLASS '[' (TERM '->' TERM)* ']'

provides no good way to do this.  I see several options:

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?

Option B. Use the FLD syntax for PRD.  The concern is that this is 
overly general and thus PRD would have many hard to specify restrictions 
on the use of Exists in a conclusion.

Option C. use a builtin (e.g. rif:new) so that object creation could be 
in core.  E.g.

Forall ?x (And(rif:new(1 ?x) # _Z rif:new(1 ?x)[_x->?x] rif:new(2 ?x) # 
_Y rif:new(2 ?x)[_z->rif:new(1 ?x]) :- ?x # _X)

There are n+1 arguments to rif:new.  The n Forall variables and one 
"occurrence number".  There are m distinct occurrence numbers per 
ruleset, where m is the number of existential variables in the ruleset 
that are "skolemized".  In the above, n=1 and m=2.  Note that rif:new 
has variable arity (n+1).

The drawback of option C is that production rule engines don't typically 
provide rif:new as a function.  A PRD translator would find it very 
difficult to translate rif:new in a condition, or indeed in an action 
except for when used in membership with a Class Constant and in frames.

Also, PRD would need to support And() and "#" in conclusions, but "#" 
only in the case where the left side is rif:new...

Received on Tuesday, 2 September 2008 21:37:19 UTC