Quantcast
Viewing all articles
Browse latest Browse all 9364

J Aaron Farr: Spellchecking for Programmers

Sometimes Mac OS X’s workstation legacy shines through. In TextEdit (Mail, and other Cocoa Text applications), I enable Edit > Spelling and Grammar > Check Spelling While Typing. Sometimes I write identifiers InCamelCase. Today, I noticed that Cocoa correctly checks spelling of camelCase identifiers by splitting the identifier at case change boundaries, checking each component as a word, and marking the whole identifier as misspelled if any of the component words are. (camelCase is fine, but camlCase gets underlined.)

Image may be NSFW.
Clik here to view.
ThisIsWrittenInCamelCase is fine, ThisIsWritenInCamelCase is underlined.

What about MULTiple CAPITal letters in a row? Cocoa text decides the identifier is fine when its characters form a word (as seen above) or when lowercased components form words (MULType and CAPITall are fine, but MULtype and CAPItall are underlined.)

Good heuristics.


Viewing all articles
Browse latest Browse all 9364

Trending Articles