5 ms·
In the near future, Rust's trait system literally will be a logic language similar to Prolog that runs at compile time. We walk the AST and generate statements
by tatterdemalion 10y ago
In the near future, Rust's trait system literally will be a logic language similar to Prolog that runs at compile time. We walk the AST and generate statements to prove. This is expected to be easier to reason about, to be easier to extend, and to have shorter compile times - for essentially the reason you cite. Its even given us some (as yet unexplored) ideas for new extensions.
- deegles 10y agoSerious question... should I spend time in 2017 on Prolog? It seems like another case of "everything old is new again"...
- pjmlp 10y agoYes, you surely should, even if it is just wasting a few hours over a few weekends. Getting to grasp logic programming would improve your skills, even if you never use Prolog again. Use SWI-Prolog, one of the best free implementations out there. http://www.swi-prolog.org/ http://www.swi-prolog.org/
- qznc 10y agoYes, for the concepts. Just like it helps to know relational databases, even if you always use an ORM in practice. It is debatable if Datalog is enough or if cuts et al are worthwhile.
- fauigerzigerk 10y agoNot sure if ORMs are a good analogy here. ORMs are a leaky and misleading abstraction on top of an actual RDBMS.
- charlieflowers 10y agoThe GP seems to be thinking in the opposite direction. His analogy is that knowing an ORM but not SQL is like not knowing Prolog, and that adding knowledge of SQL to your ORM knowledge is like learning Prolog. So the argument is that it is a similar eye-opening transition from ignorance to awareness.
- continuational 10y agoWell, SQL is a pretty complicated implementation of Datalog. I think it's easier to learn Prolog from first principles, since the pure subset is pretty simple.
- pjmlp 10y ago> even if you always use an ORM in practice. I seldom use an ORM, I rather leave the work for the database engine. My knowledge of PL/SQL, Transact-SQL, PL/pgSQL is way better than trying to make an ORM perform better. Something like Dapper.NET or jOOQ are good enough for the remaining part of the work.
- _nalply 10y agoTry to implement the unification algorithm yourself. Example https://unify.ly5.ch/ https://unify.ly5.ch/ (Caveat: it's an old implementation)
- sitkack 10y agohttp://www.ic.unicamp.br/~meidanis/courses/mc336/2009s2/prolog/problemas/ http://www.ic.unicamp.br/~meidanis/courses/mc336/2009s2/prol...
- chubot 10y agoProbably related? I still have to go over this: "Writing custom type systems for Python in Prolog" https://news.ycombinator.com/item?id=12108041 https://news.ycombinator.com/item?id=12108041
- dmitriid 10y agoNext step: unit tests for the type system