Re: Spell-checking source code (Was: ISO Studies of underscores...)
"Kevin Morenski" <km@nospam.geek center.net> writes:
[color=blue]
> Let's say you had a variable named "tHTa," for example. With respect to
> your concept, this would be a misspelling of the word "that." Now, a lot of
> programmers--myself included--use letters to represent certain things in
> variable names. tHTa could mean "type HTa" or anything else a programmer
> could think of. How could a program possibly differentiate between
> conventions in the naming of variables?[/color]
In the same way that spell-checkers for ordinary text today handles names and
other words that are correct, but not in the dictionary: When detecting the
unknown word the first time, ask the user what to do with it - whether to
correct it, accept this instance, accept all instances in this document or
add it to your private dictionary. (For a spell-checking of source-code we'd
probably also want the option "accept all instances with this case.")
This really isn't any different from the same problem in regular text,
except that your programming convention might cause a lot of unknown
words to appear. If that's a major headache, just don't spell-check.
--
Leif Roar Moldskred
"Kevin Morenski" <km@nospam.geek center.net> writes:
[color=blue]
> Let's say you had a variable named "tHTa," for example. With respect to
> your concept, this would be a misspelling of the word "that." Now, a lot of
> programmers--myself included--use letters to represent certain things in
> variable names. tHTa could mean "type HTa" or anything else a programmer
> could think of. How could a program possibly differentiate between
> conventions in the naming of variables?[/color]
In the same way that spell-checkers for ordinary text today handles names and
other words that are correct, but not in the dictionary: When detecting the
unknown word the first time, ask the user what to do with it - whether to
correct it, accept this instance, accept all instances in this document or
add it to your private dictionary. (For a spell-checking of source-code we'd
probably also want the option "accept all instances with this case.")
This really isn't any different from the same problem in regular text,
except that your programming convention might cause a lot of unknown
words to appear. If that's a major headache, just don't spell-check.
--
Leif Roar Moldskred
Comment