Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A lot of UI programming patterns are much easier to express in a constraint programming language. Things like data binding don't exist in logic programming, since they are captured by constraints. It is also easier to do common tasks like position elements in a way which reacts nicely due to resizing a viewport, etc.

Today constraint solving is still confined to a lot of niche applications like physics engines or CAD systems, but I keep hoping for the day that someone will build a more integrated system which makes it easier for anyone to grab constraints and plug them in where it makes sense.



Prolog isn't a numerical constraint solver.

I once had to write a menu system in Turbo Prolog. Not fun. Totally the wrong tool for the job. Prolog isn't that useful when you have to cause an action, as opposed to computing a result.


Have you used any of the numerical constraint solving libraries available for many Prolog implementations?[1] (It is also worth noting that Turbo Prolog is a rather peculiar—and now rather old—take on Prolog. I believe it has been superseded by Visual Prolog).

[1]: e.g., SWI Prolog's http://www.swi-prolog.org/pldoc/man?section=clpfd, or http://www.swi-prolog.org/pldoc/man?section=clpqr


Another issue for prolog is that many of these "constraint solving" problems will lead to exponential-time algorithms in the worst case, specially if you use a naive implementation. Because of this, its common to use more specialized solvers (linear programming, SAT, ILP, SMT, etc) instead of a general logic-programming one.


Autolayout (iOS and OS X layout engine) is built on a constraint solver.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: