Defining ConstraintSet and the constrainable algorithm in terms of it

As promised, hashing out the language of ConstraintSet....

First, an admission: I don't understand how initialization of complex
argument types in WebIDL is supposed to work.

I tried to parse the WebIDL spec to figure out "here is how you specify
that an argument of type T can be constructed from a JS Object O when O
is passed as an argument to the function that takes an argument of type
T", but I did not find it. So I guess I'm left with prose - and possibly
supporting WebIDL.

The algorithm I have in mind, which is a making-more-precise of section
11.1.2 of the current (abbreviated) draft, says:

WebIDL:

typedef object ConstraintSet;

The following operation is executed to figure out if the Constrainable
object O, which has capabilities CA, satisfies ConstraintSet C:

   - For each immediate attribute A of C (as defined by HasOwnProperty):
     - If N, the name of A, is not a member of CA, fail.
     - If V, the value of A, cannot be interpreted as a
ConstraintValues, fail.
     - If V does not permit any of the allowed values for CA(N), fail.
     - Set the constraint of N in O to be the intersection of any
previous constraint
       and V. If the result of this intersection is empty, fail.
   - If satisfaction succeeded, return the newly-constrained object O.

Here's where the now-deleted definition of ConstraintSet may come in useful:

In this algorithm specification, the access to C is done as if C had the
WebIDL definition:

[NoInterfaceObject]
interface ConstraintSetInternalRepresentation {
    ConstraintValues getter (DOMString name);
};

(this may need extension. I'm not sure how. Or it may have no value, and
should be deleted.)

Does this seem like a precise (and therefore implementable) algorithm?






-- 
Surveillance is pervasive. Go Dark.

Received on Thursday, 6 February 2014 22:50:12 UTC