Re: More extensive (variable) style checking

Jan Wielemaker <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
On 08/02/2013 09:15 PM, Michael Hendricks wrote:
> Can this system eliminate the false singleton warning on Query in a
> quasiquote like {|uri||/path?$Query|} ?  Those have become a bit of a
> thorn in my side :-)

This is an unrelated issue. Yes, I think that is possible by doing QQ
expansion before singleton warnings and walk through the QQ expanded
terms to see whether any of the singletons found so far appear in the QQ
expansion. It it surely planned to look at that at some point. If you
are in a hurry though, you might want to dig into pl-read.c ...

> Is it possible to warn about unreachable code?  For example,
>
>     t :-
>         ( ground(X) -> unreachable ; do_stuff ).
>
> That makes "failure slice" debugging generate warnings, but I think
> that's acceptable.

That would be possible. Most likely in the form of "Test always
succeeds: ground(X)", which you would already get if you used nonvar(X).
These warnings from the low level compiler are -at least now- only
generated for inlined tests. ground/1 is not one of them (yet). I don't
know whether we should go for a full-blown mode/type system, the current
limited system or something in between.

	Cheers --- Jan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.