zsh-workers
 help / color / mirror / code / Atom feed
* Re: Thoughts on self-documenting functions
@ 2000-10-04  9:41 Sven Wischnowsky
  0 siblings, 0 replies; 2+ messages in thread
From: Sven Wischnowsky @ 2000-10-04  9:41 UTC (permalink / raw)
  To: zsh-workers


Bart Schaefer wrote:

> ...
>
> One thought that I had is to put the documentation into its own function,
> which is then unfunction'd after the whole file has been autoloaded.  So
> each file _xxx would look something like:
> 
>     _xxx_doc () {
> 	some sort of documentation format
>     }
> 
>     _xxx () {
>         the actual function
>     }
> 
>     unfunction _xxx_doc
>     _xxx "$@"

Sounds interesting, but...

> This way, the doc format wouldn't have to be a comment, but would still
> get flushed out of zsh's memory after the file is loaded.  On the other
> hand, I think redefining _xxx that way prevents taking full advantage of
> memory-mapped .zwc files, which is also undesirable. 

yes, I'd say.

> However, using a
> function might let us do something clever with shell expansions to mark
> up the documentation for conversion to yodl.
> 
> Anyway, no conclusions yet, just musings.

Some time ago we were discussing (well, not really discussing, but I
mentioned it, I think) this kind of automatic documentation for the
completion system already. At that time I played a bit with such
special comments Bart described. Because I would like those comments
to be enough to automatically generate the docs I needed to make it be 
converted to yodl. I used some convention, like `foo' being turned
into `tt(foo)' and things like that, trying to keep the work load for
the function writer low. But it still was a bit clumsy.

I don't have any really good ideas either (obviously, you would have
heard about them), but I still like the whole idea of it. So that it
would allow us to 1) always keep the docs up to date, including
utility functions, 2) correctly list all tags and styles in
_complete_help, preferrably even with short descriptions 3) add a mode 
to _complete_help that displays a description like the one Peter
suggested some time ago (a real, textual description, not just a list
of things).

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 2+ messages in thread
* Re: generals observations about completion system
@ 2000-09-19  9:04 Peter Stephenson
  2000-09-20 14:33 ` Thoughts on self-documenting functions Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Stephenson @ 2000-09-19  9:04 UTC (permalink / raw)
  To: Zsh hackers list

Bart wrote:
> It does tend to be easier to add new completion functions than it is to
> document them.

I haven't had much time for replying (have you seen the specification for
Bluetooth park mode? :-() but self-documenting functions with something
like pod, except using shell functions to strip out the bits and turn them
into yodl, should be pretty easy.  Adding comments is usually much easier
than fiddling with the full documentation.

Moving the string functions to their own file would be a step in the right
direction, too.  It's hard to know what's in utils.c.  (It's not as if the
rest of the shell doesn't consist of utilities, despite the double
negative.)

By the way, I'm finally getting a week's holiday from tomorrow and luckily
in a PC-free zone.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
Cambridge Silicon Radio, Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-10-04  9:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-10-04  9:41 Thoughts on self-documenting functions Sven Wischnowsky
  -- strict thread matches above, loose matches on Subject: below --
2000-09-19  9:04 generals observations about completion system Peter Stephenson
2000-09-20 14:33 ` Thoughts on self-documenting functions Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).