# Reasons for sticking with SWI, as opposed to Mercury

**URL:** <https://swi-prolog.discourse.group/t/reasons-for-sticking-with-swi-as-opposed-to-mercury/6165>\
**Category:** General\
**Created:** [February 1, 2023, 10:11am UTC](https://swi-prolog.discourse.group/t/reasons-for-sticking-with-swi-as-opposed-to-mercury/6165 "2023-02-01T10:11:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![calatcryptomathic](https://avatars.discourse-cdn.com/v4/letter/c/8baadc/32.png) [@calatcryptomathic](https://swi-prolog.discourse.group/u/calatcryptomathic)\
**Post date:** [February 1, 2023, 10:11am UTC](https://swi-prolog.discourse.group/t/reasons-for-sticking-with-swi-as-opposed-to-mercury/6165/1 "2023-02-01T10:11:36Z")

</div>

I’m an enthusiastic amateur and I like SWI very much. I’ve often been tempted, however, to put my energies into Mercury instead because of its promises of smarter compile-time checks etc. I only write medium-sized programs (10000 lines max); I do find I spend a heck of a long time debugging my code so I just wonder if- anecdotally and empirically - there’s people who have experience in both and know the real upsides to each. Thanks!

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [February 1, 2023, 10:37am UTC](https://swi-prolog.discourse.group/t/reasons-for-sticking-with-swi-as-opposed-to-mercury/6165/2 "2023-02-01T10:37:53Z")

</div>

Without really answering your question, did you discover the SSU rules (Head =\> Body) and det/1? Since I use those, debugging time has been reduced a lot. Other recent goodies are trap/1 and gtrap/1 to quickly get the debugger at an exception. And of course, there is check/0 to do some static analysis, be it a lot less than mercury. And, last but not least the new “sweeprolog” mode for GNU emacs or the built-in Emacs clone save you a lot of work.

---

<div class="post-metadata">

**Author:** ![calatcryptomathic](https://avatars.discourse-cdn.com/v4/letter/c/8baadc/32.png) [@calatcryptomathic](https://swi-prolog.discourse.group/u/calatcryptomathic)\
**Post date:** [February 1, 2023, 10:45am UTC](https://swi-prolog.discourse.group/t/reasons-for-sticking-with-swi-as-opposed-to-mercury/6165/3 "2023-02-01T10:45:21Z")

</div>

I’ve kept an eye on posts about =\> and I’ve dabbled with BProlog which, I think, has a similar feature. Thanks for all those suggestions as I’d be very happy to stick with SWI + new debugging aids.

---

<div class="post-metadata">

**Author:** ![EricGT](https://avatars.discourse-cdn.com/v4/letter/e/f1d935/32.png) [@EricGT](https://swi-prolog.discourse.group/u/EricGT)\
**Post date:** [February 1, 2023, 10:49am UTC](https://swi-prolog.discourse.group/t/reasons-for-sticking-with-swi-as-opposed-to-mercury/6165/4 "2023-02-01T10:49:30Z")

</div>

> [@calatcryptomathic](#):
>
> there’s people who have experience in both and know the real upsides to each

I have used Mercury in the past (~10 years ago) but don’t at present, mostly because getting support was not easy but that is slowly changing.

One post of note from the creator of Mercury (Zoltan Somogyi) that has since become a key deciding factor for me was in this StackOverflow [answer](https://stackoverflow.com/a/67034818/1243762).

HTH

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [February 1, 2023, 10:58am UTC](https://swi-prolog.discourse.group/t/reasons-for-sticking-with-swi-as-opposed-to-mercury/6165/5 "2023-02-01T10:58:42Z")

</div>

> [@calatcryptomathic](#):
>
> I’ve kept an eye on posts about =\> and I’ve dabbled with BProlog which, I think, has a similar feature.

I got it from Picat. As that is a successor of BProlog, it could well come from there. Note that I made an important change though: if no rule matches it is an **error**. It you want that to fail you need a final clause `Head => fail.` The idea is the you use `=>` typically for “functions” and no matching rule is typically a mistake. In the rare case it is not you have to make this explicit. There is also no `?=>`. There is `Head, Guard => Body`

---

<div class="post-metadata">

**Author:** ![EricGT](https://avatars.discourse-cdn.com/v4/letter/e/f1d935/32.png) [@EricGT](https://swi-prolog.discourse.group/u/EricGT)\
**Post date:** [February 2, 2023, 10:56am UTC](https://swi-prolog.discourse.group/t/reasons-for-sticking-with-swi-as-opposed-to-mercury/6165/6 "2023-02-02T10:56:27Z")

</div>

6 posts were split to a new topic: [Idea for SSU debugging feature](https://swi-prolog.discourse.group/t/idea-for-ssu-debugging-feature/6170)
