[ENH] Constraint Framework

Stephen Pair spair at advantive.com
Wed Jun 9 18:45:48 UTC 1999


Hi Pierre,

> Hi,
>
> I have developed several constraint solvers (in VW and Java) and
> I was also puzzled by
> the subject of the post. However, this is very interesting. One
> of the essential
> differences between your stuff and constraints is that you only
> deal with unary
> contraints, which is a trivial application for constraint because
> there is no
> complexity.

Actually, the constraint could be more generic than that by passing not the
parameters, but rather the method context (allowing you to validate a
constraint across all paratemers, as well as some other stuff).  The simple
protocol of #test: can let you do many things.  You could for instance pass
in an array of multiple objects to create more complex tests.

> Using a full-fledged constraint framework would allow
> to lead complex checkings, such as:
> - Collection A has twice as many elements as collection B
> - All the elements of collection A are different
> - There is a given design pattern in a given library
> And arbitrarily complex combinations thereof...
> All these validations could be easilly (but not necessarily
> efficiently) performed
> statically.

That would indeed be very nice.  If one were to place such complex
constraints on objects in general (not just method contexts, or their
parameters in this case), one could use constraint solving techniques to
query for objects satisfying a set of constraints (if I understand
constraint programming correctly).

> Dynamical verification raises tricky issues, but
> would increase the expression usefulness of such a framework dramatically.

I'm curious to hear more of your thoughts on dynamic verification.  I would
like to see a system where one could add constraints of various forms to a
system and then to be able to 1) validate those constraints during
execution, 2) determine where constraints were violated during debugging, or
3) be able to find solutions to constraint to help fix a problem...and not
be required to do any of these if you don't wish to (as some languages would
have you do).  There's even a possibility for some really cool testing
frameworks that work like this: "find all objects in my image that satisfy
all constraints on a given method and test the method against all of them."
You may be able to significantly refine your constraints this way.

> Anyway I am porting my solver in Squeak, I don't know exactly
> when it is available, hopufully soon.
> It could be helpful for implementing a more
> complex version of your
> framework.

Excellent!  Complexity is not something I generally strive for...let's call
it a "more capable" framework.  :)

>  The idea being that constraint resolution allows to
> deal with complexity
> very efficiently.
>
> - Pierre





More information about the Squeak-dev mailing list