Webel: Mathematica: CONVENTION: Argument help holders use a String variable with the prefix '$arg$', a related '$info$arg$' String, a 'def$arg$' default value expression and/or 'req$arg$', and optional '$warn$arg$', '$tip$arg$, '$lab$arg$', 'type$arg$'..

Webel IT Australia promotes the amazing Mathematica tool and the powerful Wolfram Language and offers professional Mathematica services for computational computing and data analysis. Our Mathematica tips, issue tracking, and wishlist is offered here most constructively to help improve the tool and language and support the Mathematica user community.
DISCLAIMER: Wolfram Research does not officially endorse analysis by Webel IT Australia.
Icon class
icon_class
far fa-sticky-note
icon_class_computed
far fa-sticky-note
Note kind
Policy level
Mathematica keywords
Webel Mathematica keywords
Keywords

This naming pattern for Webel argument help holders for Mathematica is used throughout all Webel IT Australia coding of Mathematica libraries.

Example:

$arg$doShow = "doShow";
$info$arg$doShow = "Whether to show something.";
def$arg$doShow = True;
$warn$arg$doShow = "Setting this True may make the display much larger.";

Where an argument is required, no 'def$arg$' is provided, and the Webel help Rule maker (used to register it with the Webel help system) will detect that it is a required argument.

An additional "type" indicator (used only for documentation) may also be provided:

type$arg$doShow = (True|False);
Or using a Webel pattern helper:
type$arg$doShow = $pat$bool;
Additionally, a UML/SysML style multiplicity indicator (used only for documentation) may be provided as:
$mult$arg$doShow = "[0..1]";
An '$arg$ may also optionally have a label for GUIs and other views (although this is not used as much as for '$opt$' options):
$lab$opt$doShow = "Show?";

The Webel utility functions are able to leverage this pattern to create ::usage documentation Strings (via the Doc` package), for the Webel Var` variables Entity registry, for the Webel code-oriented HelpF` and HelpO` help registries, and in many other useful ways, such as with Tooltip info in tables, GUIs, and other displays.

This naming pattern works well for prompting in Mathematica notebooks and in IDEs (so much less typing of Strings)!

Functions that use an argument may choose to leverage the 'def$arg$' default for the Pattern template for a particular argument or override it. The use of the 'def$arg$' default for an argument Pattern makes it easier to change the policy for the default across a project (nice and DRY).

The '$arg$' convention is often used together with these Webel help holder conventions: There is a detailed technical slide trail describing how the Webel naming conventions for Wolfram Language code work together:

If you are a fan of object-orientation (and have understood it CAN be used together with functional programming), you might be wondering why the policy isn't encapsulated as a class. Mathematica does not yet have vendor supported OO. The Webel argument help holder naming pattern shown can indeed be used with the user contributed MTools package for OO in Mathematica, but is also designed to work with regular Wolfram Language usage.

Relates to
Related notes
Related notes (backlinks)
Related snippets (extracts)
Visit also
Visit also (backlinks)