Hacker News new | ask | show | jobs
by xlayn 3594 days ago
Why is such complication introduced and what are the benefits of it?

      firstVar || (secondVar=='Bob' && thirdVar==41)
seems very clear to me.

On the other hand JavaScript has always had logic operators... therefore has always been able to perform logic programming.....

From http://www.ecmascript.org/es4/spec/overview.pdf page 18

  “&&=” and ”||=” operators
     ES4 introduces assignment operators for the logical   
     “&&” and “||” operators. These assignment operators
     are short-circuiting; if the value of the left-hand- 
     side determines the value of the result then the right-     
     handside is not evaluated.
1 comments

This library can do Prolog-style solving of logical expressions. As in "here is a set of expressions, find me values for the variables that fulfill them." Completely different thing.

classical example in the readme: https://github.com/mcsoto/LogicJS#goals

Thanks for the reply; "Prolog-style solving of logical expressions in JS" sounds like a better title.
"Prolog-style solving of logical expressions" is actually called "logic programming". It's the name of the paradigm.

https://en.wikipedia.org/wiki/Logic_programming

IMO the title is fine.

Next time please at least click the link before chiming in with a comment. The title was not the problem here.