RFC: add help, what to the console build #688

Merged
merged 1 commit into from Feb 20, 2014

Projects

None yet

3 participants

@IngoHohmann
Contributor

This is more like a request for comments, as it is my first time to try this, hope it works.

Adding help and watch to the console build:

red>> help help

USAGE:
help func-name

DESCRIPTION:
Get help for functions

ARGUMENTS:
'func-name => Word you are looking for

REFINEMENTS:

What would be the best way to add tests to these functions, which return nothing, but only print?

@PeterWAWood
Contributor

The best way to test this is to write quick-test.r tests and use the —assert-printed? assertion.

There is an example in the test suite - Red/tests/source/compiler/print-test.r

If you don't use Red/quick-test/run-test.r %your-test.r to run the test you will need to do %quick-test.r inside your test script.

For tests written using quick-test.r, you will need to write both compiler and interpreter tests. This means duplicating the tests and enclosing the test code in a do block to test the interpreter. (We automatically generate interpreter tests for tests written with quick-test.red).

@dockimbel
Member

Nice!

You should declare manually all the local words used in your parsing rules with SET or COPY as they won't be auto-detected by FUNCTION constructor.

Other remarks:

  • it would be nice to have HELP display a usage text when invoked with no arguments.
  • adding the pattern searching feature of the Rebol HELP would be really cool
  • WHAT should display (aligned) the descriptive docstring for functions.

BTW, Gregg has wrote a HELP port also for Red along with a bunch of mezzanines but it's on AltME in %red/mezz/ folder. You should have a look at it.

I am merging it anyway, you can just send me more pull requests with updates.

@dockimbel dockimbel merged commit f5e579c into red:master Feb 20, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment