Conversation

Makam does not have modes - this was invented syntax, hehe. In the case of Mecury it uses them to generate different implementations of the same predicate. You can have multiple mode decls for the same predicate. If you try to use a mode that is not in that list it's an error.
2
1
This is in contrast to Makam and Prolog where the information seems to flow (?) dynamically. This is more expressive than Mercury, but harder to make run fast, from speaking to Mercury folks at work.
1
1
I do find that I somtimes will do a typo and that results in a foreverlööp, and I _think_ the mode checker from Mercury would catch some of that. Or maybe I'm thinking of the determinism checker…
1
Like, maybe it would be better to say: check : in -> in -> in -> semidet. synth : in -> in -> out -> semidet. To say that both of those might fail, but are otherwise deterministic. Check with an output mode for the type would be: check : in -> in -> out -> nondet.
1
1
Yep. As says, each predicate may have more than one mode in Mercury, each mode has exactly one determinism (can fail, will not fail, may have multiple answers etc). Each time you use a predicate the compiler can figure out which mode of that predicate you need.
1
2
In that way, the compiler knows statically the instantiation state of each variable at each moment of execution. In Prolog this is dynamic and modes are provided mainly as documentation for humans. A variable you encounter may have a value, or no value, or a partial value.
1
2
or may have no value but may also be aliased with other variable with no value! Giving either a value gives the other the same value.
1
Show replies