Re: Ann: SWI-Prolog 7.1.0
Nicos Angelopoulos (Univ of York) <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <20131211112148.2b109564@ampelos> |
Dear Jan,
> I am unsure. I haven't seen that many cases where switching on the
> native type is crucial performance-wise and as we have seen here,
> the application types are often not a one-to-one mapping from the
> system types. It is easy enough to write a term_type/2 doing the
> right thing for the real library. If it proves to be too slow, we
> can always consider adding leading type checks to the clause indexing,
> such that you can write your (application specific) term_type/2 more
> efficiently.
>
> Cheers --- Jan
As i said I am unsure myself.
term_type/2 though, seems to have an intuitive reading and be benign.
In the cases that it is useful it can be used in combination with
Prolog's indexing to produce readable and computationally, well behaved
code with no extra gimmicks.
I am currently fascinated by indexing, so my lenses are tinted.
The other argument I can see against term_type/2 is that somehow it has
to have a special status/meaning when called with 2 variables as arguments.
Of course I know how to implement it in Prolog,
as I know how to implement append/3 (I think).
Efficiency though, can be measured in many ways.
Using well understood basic constructs that are known to all, allows us to
efficiently produce efficient programs that are easy to follow and maintain
by us and others. Think append/3 again.
The best thing to do it would seem to be to leave this in the back burner
and add it if you later on find other places it might be useful.
Regards,
Nicos