[ENH] Constraint Framework

Markus Kohler markus_kohler at hp.com
Wed Jun 9 08:05:36 UTC 1999


Stephen Pair wrote:
> 
> It has been brought to my attention that what I meant to say was "assertion
> framework."  ;-)

True. 
I've been doing a lot of AI stuff at university and when I read your subject I
thought
, oh that's something I'm familiar with. 

I was a bit surprised to find out that the package is more like a "assertion
framework". 

Anyway I still believe it's a very good thing. 

> 
> Actually, what this code really does is provide an easy way to "constrain"
> the arguments of methods to objects belonging to a domain specified by the
> "constraint."  It does this without intruding on the source code of the
> methods.  Also, the debugger highlights contexts where such "constraints"
> have been violated.
> 
> I called it a constraint framework because I envision the constraints
> applying not just to method arguments, but also slot variable relationships.
> Also, systems of objects could have constraints imposed upon them, with an
> easy to use interface for describing and validating these constraints.  I
> also had the whole issue of static typing and Java interfaces in the back of
> my mind, with an idea to formalize protocols (I believe Dolphin has done
> this already) and build new types of constraints based on these formalized
> protocols.  My motivation is one of providing tools that enable one to get
> the benifits of statically typed languages without the limitations.

Good idea. One thing I would like to have is a design by contract (DBC).
I'm wondering if it would be difficult to implement this using your 'assertion
framework'.
One  would need for example to be able  to call the assertion checking code of a
superclass. 

> 
> As such, the framework is not a constraint solver, as one might have been
> lead to believe by the subject.  But, to say it's an assertion framework
> would be too limited a view.  I have certainly started thinking how this
> approach and constraint oriented systems might intersect (I'm not well
> versed in constraint oriented systems).
> 

I could imagine to build a constraint checking system that could decide for a
given
piece of code if it's consistent regarding the types and if so what is the most
general
solution.  

But this would require to limit the code possible for those assertions to some
simple functions. 
Or maybe a prolog like language  could be used ...

Markus
-- 
Markus Kohler  mailto:markus_kohler at hp.com





More information about the Squeak-dev mailing list