Constraints -//- first release -//- Flexible abstract class based validation for attributes, functions and code blocks

Nathan Rice nathan.alexander.rice at gmail.com
Thu Jan 26 15:24:09 EST 2012


On Thu, Jan 26, 2012 at 2:51 PM, Devin Jeanpierre
<jeanpierreda at gmail.com> wrote:
> Ooh, runtime turing-complete dependent-types. :)
>
> I'm not sure if you're aware of the literature on this sort of thing.
> It's nice reading. A library such as this that's designed for it could
> be used for static checks as well.

Actually, that is kind of the direction I was going :)

One of the nice things about Haskell is that the language is designed
in a way that is conducive to
proving things about your code.  A side benefit of being able to prove
things about your code is that
in some cases you will be able to derive code just from well crafted
specifications (like higher order
Prolog).  This isn't a game changer yet, but with advances in theorem
proving software and a thoughtful
language ontology, I could see it taking off very soon.  Dijkstra was
focused primarily on this area for the
last 25 years of his life.

> Probably deserves a better name than "constraintslib", that makes one
> think of constraint satisfaction.

As you can probably tell from my other projects, I'm bad at coming up
with snappy names.

> Any way to get them to raise a different error, such as ValueError (in
> particular for preconditions)?

Currently, no.  I would like to add an event mechanism, or some kind
of function hooks (ala Enthought Traits but much lighter).  I'm sure
I'll come up with something soon :)

Nathan



More information about the Python-list mailing list