[m-users.] Problem with XML extra library

Julien Fischer jfischer at opturion.com
Thu Jun 23 21:04:43 AEST 2022



On Thu, 23 Jun 2022, Zoltan Somogyi wrote:

> The reason why the code you are talking about works is because
>
> - the pstate/5 predicate called near the start of that clause has
>  <io> and <pstate(unit)> as its two DCG arguments;
> - the finish/3 predicate called near the end of that clause has
>  <pstate(T1)> and <io> as its two DCG arguments; and
> - the code in between uses !IO to refer to variables whose type is
>  pstate(T) for some T.
>
> That last part is misleading for human readers, but the compiler
> neither knows this, nor does it care. This probably happened
> because the person converting the code from DCGs to state variable
> notation did not notice the switch in types from io states to pstates
> and then back to io states. (When the code still used DCGs,
> the code was less misleading, because the variables holding the pstates
> were nameless, instead of having misleading names.)
>
> I will look into fixing this readability/style issue.

Given the code that was quoted, I suspect Volker is looking at the
version of tryit.m from the 22.01 branch, rather than what's currently
on the trunk. That version of tryit.m does not use state variables at
all, only DCGs.

The confusion with the variable naming on the trunk was an oversight
on my part when I updated that code to conform with the recent library
changes.

Julien.


More information about the users mailing list