3 ms·
I agree that embedding Prolog is a compelling use case. I ported Trealla Prolog to WASM to help the cause. It's super cool being able to store some business rul
by grose 4y ago
I agree that embedding Prolog is a compelling use case. I ported Trealla Prolog to WASM to help the cause. It's super cool being able to store some business rules as a chunk of Prolog text and run them on both the backend and the frontend as-is.
Want to explore your code, maybe test out some quick changes? Prolog comes with a nice REPL. Want to modify the knowledgebase? Add some clauses with assertz/1 and dump out the full program code with listing/0; no need to wrangle the text yourself. Want to make a previously static relationship more dynamic? Just throw in a new rule: as far as Prolog is concerned rules and facts are equal citizens. It's like a database that lets you intermix static and dynamic row definitions anywhere you want. Testing it is easy: Prolog will happily give you every possible result for a general query. Want to generate error messages from chunks of code, or run your queries backwards? Just throw in a little metainterpreter[1].
I think Prolog is the perfect companion language to static and difficult-to-extend languages like Go. I think that if we want Prolog to become more popular, we should focus on a great embedding experience for developers. That's my current goal :)
[1]: https://www.metalevel.at/acomip/ https://www.metalevel.at/acomip/