[FoRK] Constraint system library in Javascript

Ken Meltsner meltsner at alum.mit.edu
Wed Jul 17 11:16:31 PDT 2013


People who have actually read my infrequent posts to FoRK might remember
that I'm a big fan of declarative programming techniques like constraint
programming.  Here's a pretty cool library in vanilla Javascript.

http://cjs.from.so/

Really good for dynamic UIs where you want several UI elements to update
automatically when any one of them is changed.  Long ago, wrote a
finite-element analysis display system that included a fancy gray scale
range manipulator.  I used Garnet, a Common LISP constraint library, and
this is a grandchild or great-grandchild of that system.

There are other genetic lines for constraint programming -- Adobe had a
pretty neat system at one point that they eventually open-sourced, for
example.



Ken Meltsner

Excerpt:

ConstraintJS is a JavaScript library for writing *constraints* —
relationships that are declared once and maintained automatically.
ConstraintJS runs on both client-side (Chrome, Firefox, Safari) and
server-side (Node.js)
 Download (v0.6.1)<https://github.com/downloads/soney/ConstraintJS/cjs_0.6.1.zip>
 Read the Guide <http://cjs.from.so/guide.html>
 Contribute to the project <https://github.com/soney/ConstraintJS>
  Shorter, cleaner code

ConstraintJS automatically maintains relationships between variables and
DOM elements so that you don't have to.
 Plays with others

ConstraintJS allows "hooks" to be written for third party libraries. In
addition, ConstraintJS works with asynchronous libraries.
 Simple syntax

ConstraintJS was designed to be integrated with any code base requiring
minimal modification.


More information about the FoRK mailing list