Skip to content

Naming conventions

Jan Stolarek edited this page Apr 3, 2019 · 2 revisions

Naming conventions

This page gathers some naming conventions to adopt for files and module names, initially for discussion.

Tentative conventions

  • Adopt CamelCase for module names, with file names initially lower-case.
  • Standardize on capitalizing acronyms entirely, unless at the beginning of a name in which case the acroynm can be all-lower-case. Avoid acroynms in the middle of identifiers, if this is unavoidable, the following word should be decapitalized to avoid confusion with the acronym.
  • Avoid abbreviations such as "db" for "database", "js" for "JavaScript", etc. If abbreviations are used (e.g. "absyn", "IR", "eval") then use them consistently.
  • Prefer "verb noun" for modules that do something, and "noun noun" for modules that provide something, e.g. typecheckIR, typecheckAbsyn vs absynTypes, absynTraversals. As a special case, translation stages can be compound, e.g. irToJavaScript, 'absynToIR`
  • Wherever it makes sense, plunge related modules down a directory level

Existing names and proposed changes

These are tentative suggestions, coevolving with the tentative guidelines above. Comments welcome.

PP.ml --> prettyPrinting.ml
backend.ml 
basicsettings.ml  --> basicSettings.ml
buildTables.ml  
channelVarUtils.ml
chaser.ml
checkXmlQuasiquotes.ml  --> checkXMLquasiquotes.ml
closures.ml
commonTypes.ml  
compilePatterns.ml
database.ml
dbDriverDynload.ml   --> databaseDriverDynload.ml
debug.ml
defaultAliases.ml
desugarAlienBlocks.ml
desugarCP.ml
desugarDatatypes.ml
desugarDbs.ml    --> desugarDatabases.ml
desugarFormlets.ml
desugarFors.ml
desugarFuns.ml
desugarHandlers.ml
desugarInners.ml
desugarLAttributes.ml
desugarModules.ml
desugarPages.ml
desugarProcesses.ml
desugarRegexes.ml
desugarSessionExceptions.ml
dumpTypes.ml
env.ml
errors.ml
evalir.ml  -> evalIR.ml
eventHandlers.ml
experimentalExtensions.ml
fixTypeAbstractions.ml
frontend.ml
generalise.ml
getopt.ml
graph.ml
instantiate.ml
ir.ml
irCheck.ml  --> checkIR.ml
irTraversals.ml  
irtojs.ml  --> irToJavaScript.ml
js.ml  --> javaScript.ml
json.ml
jsonlex.mll --> jsonLexer.mll
jsonparse.mly --> jsonParser.mly
lens.ml
lens_database_conv.ml  --> lensDatabaseConversion.ml
lens_sugar_conv.ml  --> lensAbsynConversion.ml
lens_type_conv.ml  --> lensTypeConversion.ml
lens_value_conv.ml  --> lensValueConversion.ml
lib.ml
liftRecursive.ml
linksregex.ml  --> linksRegex.ml
loader.ml
moduleUtils.ml
multipart.ml
notfound.ml
operators.ml
page.ml
parse.ml
parseSettings.ml
parseXml.ml   --> parseXML.ml
performance.ml
proc.ml
processTypes.ml
regex.ml
requestData.ml
resolveJsonState.ml  --> resolveJSONstate
resolvePositions.ml
rewrite.ml
scanner.ml
settings.ml
sourceCode.ml
sugarConstructors.ml  --> absynConstructors.ml
sugarConstructorsIntf.ml  --> absynConstructorsIntf.ml
sugarTraversals.ml  --> absynTraversals.ml
sugartoir.ml   --> translateAbsynIR.ml
sugartypes.ml  --> absynTypes.ml
tables.ml
transformSugar.ml
typeSugar.ml  --> typecheckAbsyn.ml
typeUtils.ml
types.ml
typevarcheck.ml  --> typeVarCheck.ml
unify.ml
unionfind.ml
utility.ml
value.ml
var.ml
webif.ml  --> webInterface.ml
webserver.ml  --> webServer.ml
webserver_types.ml  --> webServerTypes.ml
websocketMessages.ml  --> webSocketMessages.ml
xmlLexer.mll
xmlParser.mly

Some proposals by @jstolarek below. I only listed those that differ from James' proposals. Also, these are probably not final.

checkXmlQuasiquotes.ml  --> checkXMLQuasiQuotes.ml
dbDriverDynload.ml   --> databaseDriverLoader.ml
desugarCP.ml  --> ???
desugarDbs.ml  --> desugarQueries.ml
multipart.ml  --> parseMultipart.ml
notfound.ml  --> notFound.ml
parse.ml  --> parseLinks.ml
proc.ml  --> process.ml
resolveJsonState.ml  --> resolveJSONState.ml
sugarConstructors.ml  --> linksConstructors.ml
sugarConstructorsIntf.ml  --> linksConstructorsIntf.ml
sugarTraversals.ml  --> linksTraversals.ml
sugartoir.ml   --> linksToIR.ml
sugartypes.ml  --> linksSyn.ml
transformSugar.ml --> linksTransforms.ml
typeSugar.ml  --> typecheck.ml

I find CP shortcut (in desugarCP) very uninformative. Don't know how to replace it.