Re: More extensive (variable) style checking

Anne Ogborn <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
The real issue here is failing to select appropriate feedback to the user. Consider a word processor with
grammar checking that is known to often be wrong, but is right often enough to be useful. Word handles this
by a special style of underline as feedback. You can right click and mark this as always OK.
Java's equivilent is the @supresswarnings notation

What seems appropriate here is not a warning message - programmers usually feel compelled to clean up warnings,
since otherwise every engineer behind them feels compelled to go check the warnings.
What does seem appropriate is a style hint mark or underlining or some such in the editor. Such style hints can legitimately be ignored if they're irrelevant, though usually every dev team has somebody who feels compulsively obligated to fix them all, and my argument above about 'feel compelled' creeps back in. At some point the cure is pushback from the forces of 'my computers here for me, I'm not here for my computer'.

Eclipse uses the small triangle with ! sign as an icon on the left margin on lines that trigger it's style checker.
(this is the highway sign for danger in the US). 
Hovering over the line gives a popup that explains the warning, and often even offers one or several 'quick fix' options to automagically correct the issue. So for example 
if (foo = 0) {

(for those not versed in Java, that's probably a bug, it assigns 0 to foo and always fails)
generates a yellow underline under the =, a yellow danger sign on the left, and right clicking on the text offers a popup that says roughly
      Assignment in conditional
      Quick fix
      Change to ==                  <-- underlined link.  clicking it changes the code

As for disjunctions, I'm with Alan - at worst I see this as a minor style issue, but more realistically the most common use I make of disjunction is to avoid a helper predicate. 

t :-  t_helper(X),
      writeln(X).

t_helper(X) :- hello(X).
t_helper(_) :- world.

Suspect this is a case of programming as an area of math trumping programming as a craft.
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.