guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: redirected 'help' output?


From: Mikael Djurfeldt
Subject: Re: redirected 'help' output?
Date: 06 Nov 2000 21:33:09 +0100
User-agent: Gnus/5.0807 (Gnus v5.8.7) Emacs/20.7

Marius Vollmer <address@hidden> writes:

> Matthias Koeppe <address@hidden> writes:
> 
> > help is a macro.
> 
> What is the reason that help is a macro?

1. In Scheme, variables have traditionally been distinct from symbols.
   (It is only with the recent `eval' that a connection has been
   made.)  Therefore, when asking for the documentation for a
   binding, the expression `(help <name>)' seems more natural than
   `(help '<name>)'.  Since (help <name>) wants to present the user
   with a list of modules which provide a binding for <name>, help
   must be a special form.

2. Since help is a special form, it can use exceptions to standard
   syntax to provide multiple functionality.  Currently, (help <name>)
   lists modules providing binding <name>, (help "<regexp>") lists
   modules providing bindings matching <regexp> and (help ,<expr>)
   looks up documentation for a particular object.

3. Help might want to use knowledge about the environment in which it
   is evaluated.  (This knowledge might be better provided in a
   different way, though.)

> (It's actually a `syntax', not a macro, which is even worse.)

Given the current macro system, the special form `help' was most
easily implemented as an "acro".  Why is this bad?

> If help needs to be a macro or syntax, I think there should be a nice
> interface to the help system that can be used programmatically with
> out using tricks like this
>
> > (with-output-to-string 
> >   (lambda () ((macro-transformer help) (list 'help 'cons) the-environment)))

The natural code is

  (with-output-to-string
    (lambda () (help cons)))

The reason why this doesn't work is a bug in the macro system (a bug
which I think was fixed long ago but has been reintroduced some time
recently).  There should be some code in the evaluator which
unmemoizes the keyword and patches it back.

Though, to me it seems like a strange thing to use the output of
`help'.

Most bindings in (ice-9 session) are intended as interactive session
support for the repl.  In cases where this is what one wants, the
redirection above is one way to do it.

But, usually, when one wants a programmatic interface, one has
something more specific in mind.  It is then more natural to use

  (ice-9 documentation): object-documentation

or

  (ice-9 session): apropos-fold

or some combination of the two.

`help' is really not much more than an user-level interface to the
existing programmatic interface.

But, sure, if people can think of nice bindings that should be part of
the documentation system API, then we should consider adding/using
them.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]