A nice property of @help is that it is operating-system- and editor-neutral, so we'll all benefit.
Note that there are other compiler directives such as @ref and @number. They all start with "@" which is why "@help" does.
Here is the description:
@help is a Cobra directive to generate an HTML help file for a given expression, statement or declaration. The file is intended to give the developer:
* information about the topic in general
* interfaces to types
* a link to the Cobra wiki where appropriate
* a link to the specific type's documentation on the web, where determinable
* ready-made search links
Examples:
# the most typical use will be for expressions, especially objects and methods:
digest = @help hasher.computeHash(fs)
grid = @help GridView()
# additional uses:
@help print 10
@help assert x < y
@help def sum(x as int, y as int)
When the file is compiled with Cobra, the help file will be created and opened.
The syntax for @help is:
@help <expr>
@help <statement>
@help <declaration>
Or simply:
@help <thing>
Note that @help <thing> passes <thing> through such that it is still compiled as part of the program. @help has the side effects of:
* writing an HTML help file for the given topic
* opening the HTML file in the default web browser
* outputting a warning
By default, the file is written to the current directory with the name "Help.TOPIC.html". You can change the behavior through environment variables. For example:
- Code: Select all
COBRA_HELP_DIRECTORY=$HOME/Projects/Cobra/Help
COBRA_HELP_FILENAME=TOPIC.html
COBRA_HELP_OPEN=1
(In bash you might prefix these with "export" in a shell script. In Windows, it is "set".)
COBRA_HELP_OPEN can be set to a boolean value (true, 1, false or 0) or set to the path of a program to execute on the help file.
@help drastically reduces the time spent looking up information, especially API information.
You can also use @help to explore other people's code bases.
Although the help file will evolve as I implement this, ideas for content include:
* links in the footer and or header of the page to the Cobra web site
* the file name and line number where @help occurred
* the original source code
* for an expression, its type
* for an expression, the API in Cobra syntax for the type
* for a method or property invocation, the API in Cobra syntax of the receiving type
* a link to the Cobra site for any language element such as the print statement, the use directive, etc.
* for each type, a link to its exact documentation page, if determinable
** example: http://msdn.microsoft.com/en-us/library ... etime.aspx
* for a method or property, a link to its exact documentation page, if determinable
* for each type, search links for:
** msdn <type>
** .net <type>
** cobra language <type>
** C# <type>
... or something like that. I'll refine the search links as I go.
It will take some time to implement this. I'll probably start with expressions where this is most sorely needed (for the help on library types and their methods). When it's worth checking out, I'll announce here in the discussion forum.
Feedback is welcome.