unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* manual examples - self contained or not?
@ 2012-02-19 16:42 Ian Price
  2012-02-19 17:50 ` Nala Ginrut
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Ian Price @ 2012-02-19 16:42 UTC (permalink / raw)
  To: guile-devel


Hi guilers,

is there an "official" policy on whether or not examples in the manual
should be self contained?

On IRC, kudkudyak was confused about read-line not being found when he
tried to run one of the socket examples. Naturally, I pointed out that
this is because read-line is in (ice-9 rdelim).

Some manual examples, however, do include imports
https://www.gnu.org/software/guile/manual/html_node/Hash-Table-Reference.html
includes srfis 1 and 13.  An example in
https://www.gnu.org/software/guile/manual/html_node/Dynamic-FFI.html
includes (rnrs bytevectors).

With the obvious exception of examples whose entire purpose is to show
off the module system, and similar, I think we should adopt a consistent
policy one way or the other, and adapt all the examples to it.

My vote would be for self-contained: it can be copied directly into a
file or REPL and executed, and IMO reduces confusion. I already try to
do this when posting any examples on paste.lisp.org or in a gist.

Other people may feel differently, as it is relatively easy to search
the manual for missing procedures and, as cky put it, "I don't believe
in copypasta coding".

-- 
Ian Price

"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"




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

* Re: manual examples - self contained or not?
  2012-02-19 16:42 manual examples - self contained or not? Ian Price
@ 2012-02-19 17:50 ` Nala Ginrut
  2012-02-21 21:14   ` Neil Jerram
  2012-02-19 21:02 ` Noah Lavine
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Nala Ginrut @ 2012-02-19 17:50 UTC (permalink / raw)
  To: Ian Price; +Cc: guile-devel

[-- Attachment #1: Type: text/plain, Size: 1546 bytes --]

well, I don't believe in copy-paste code too.
But my vote would be "at least I can trust the official manual"...

On Mon, Feb 20, 2012 at 12:42 AM, Ian Price <ianprice90@googlemail.com>wrote:

>
> Hi guilers,
>
> is there an "official" policy on whether or not examples in the manual
> should be self contained?
>
> On IRC, kudkudyak was confused about read-line not being found when he
> tried to run one of the socket examples. Naturally, I pointed out that
> this is because read-line is in (ice-9 rdelim).
>
> Some manual examples, however, do include imports
>
> https://www.gnu.org/software/guile/manual/html_node/Hash-Table-Reference.html
> includes srfis 1 and 13.  An example in
> https://www.gnu.org/software/guile/manual/html_node/Dynamic-FFI.html
> includes (rnrs bytevectors).
>
> With the obvious exception of examples whose entire purpose is to show
> off the module system, and similar, I think we should adopt a consistent
> policy one way or the other, and adapt all the examples to it.
>
> My vote would be for self-contained: it can be copied directly into a
> file or REPL and executed, and IMO reduces confusion. I already try to
> do this when posting any examples on paste.lisp.org or in a gist.
>
> Other people may feel differently, as it is relatively easy to search
> the manual for missing procedures and, as cky put it, "I don't believe
> in copypasta coding".
>
> --
> Ian Price
>
> "Programming is like pinball. The reward for doing it well is
> the opportunity to do it again" - from "The Wizardy Compiled"
>
>
>

[-- Attachment #2: Type: text/html, Size: 2284 bytes --]

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

* Re: manual examples - self contained or not?
  2012-02-19 16:42 manual examples - self contained or not? Ian Price
  2012-02-19 17:50 ` Nala Ginrut
@ 2012-02-19 21:02 ` Noah Lavine
  2012-02-19 21:18 ` Andy Wingo
  2012-02-22 21:35 ` Ludovic Courtès
  3 siblings, 0 replies; 7+ messages in thread
From: Noah Lavine @ 2012-02-19 21:02 UTC (permalink / raw)
  To: Ian Price; +Cc: guile-devel

Hello,

> My vote would be for self-contained: it can be copied directly into a
> file or REPL and executed, and IMO reduces confusion. I already try to
> do this when posting any examples on paste.lisp.org or in a gist.

When you say "self-contained", do you mean that if the example uses a
procedure from a module, it should have a (use-modules ...) statement?
If so, that sounds good to me.

If you mean that most examples should never use procedures that are in
modules, that seems a little restrictive.

Noah



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

* Re: manual examples - self contained or not?
  2012-02-19 16:42 manual examples - self contained or not? Ian Price
  2012-02-19 17:50 ` Nala Ginrut
  2012-02-19 21:02 ` Noah Lavine
@ 2012-02-19 21:18 ` Andy Wingo
  2012-02-22 21:35 ` Ludovic Courtès
  3 siblings, 0 replies; 7+ messages in thread
From: Andy Wingo @ 2012-02-19 21:18 UTC (permalink / raw)
  To: Ian Price; +Cc: guile-devel

On Sun 19 Feb 2012 17:42, Ian Price <ianprice90@googlemail.com> writes:

> With the obvious exception of examples whose entire purpose is to show
> off the module system, and similar, I think we should adopt a consistent
> policy one way or the other, and adapt all the examples to it.

FWIW, I agree.

> My vote would be for self-contained: it can be copied directly into a
> file or REPL and executed, and IMO reduces confusion.

I agree also, with the caveat that a

  (use-modules (foo))

at the top of a manual page should imply that the module is used in all
subsequent examples.

Thoughts welcome from others, of course; and regardless, patches will
move the conversation along :)

Andy
-- 
http://wingolog.org/



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

* Re: manual examples - self contained or not?
  2012-02-19 17:50 ` Nala Ginrut
@ 2012-02-21 21:14   ` Neil Jerram
  2012-02-21 22:04     ` Andy Wingo
  0 siblings, 1 reply; 7+ messages in thread
From: Neil Jerram @ 2012-02-21 21:14 UTC (permalink / raw)
  To: Nala Ginrut; +Cc: Ian Price, guile-devel

Nala Ginrut <nalaginrut@gmail.com> writes:

> well, I don't believe in copy-paste code too.
> But my vote would be "at least I can trust the official manual"...

I did think it would be nice, a while back, if we could implement a way
of automatically checking that the examples in the manual are still
correct, and that they generate the results that the manual says they
do.  I think that would contribute to being able to trust the manual, or
else flag up any areas that might have rotted a bit.

In order to do that, without requiring too much special casing code, the
checker would need to be able to identify any required module uses.

So, in addition to the direct benefit for people reading the manual, I
think that motivates that the example should be by some definition self
contained.  As others have suggested, I'd favour automatically picking
up (use-modules ...) forms from earlier or higher up in the current
hierarchy, so that it isn't necessary to keep repeating those in every
@example.

Does anyone fancy the automatic checking project?

      Neil



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

* Re: manual examples - self contained or not?
  2012-02-21 21:14   ` Neil Jerram
@ 2012-02-21 22:04     ` Andy Wingo
  0 siblings, 0 replies; 7+ messages in thread
From: Andy Wingo @ 2012-02-21 22:04 UTC (permalink / raw)
  To: Neil Jerram; +Cc: Ian Price, guile-devel

On Tue 21 Feb 2012 22:14, Neil Jerram <neil@ossau.homelinux.net> writes:

> Does anyone fancy the automatic checking project?

Someone could use our lovely (texinfo) modules :-)

Andy
-- 
http://wingolog.org/



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

* Re: manual examples - self contained or not?
  2012-02-19 16:42 manual examples - self contained or not? Ian Price
                   ` (2 preceding siblings ...)
  2012-02-19 21:18 ` Andy Wingo
@ 2012-02-22 21:35 ` Ludovic Courtès
  3 siblings, 0 replies; 7+ messages in thread
From: Ludovic Courtès @ 2012-02-22 21:35 UTC (permalink / raw)
  To: guile-devel

Hi Ian,

Ian Price <ianprice90@googlemail.com> skribis:

> Some manual examples, however, do include imports
> https://www.gnu.org/software/guile/manual/html_node/Hash-Table-Reference.html
> includes srfis 1 and 13.  An example in
> https://www.gnu.org/software/guile/manual/html_node/Dynamic-FFI.html
> includes (rnrs bytevectors).

What I typically do is to add ‘use-modules’ clauses for modules that are
not those being discussed.

So the above example has no (system foreign) import, on the assumption
that it’s implicit in its context, but it has (rnrs bytevectors).

Thanks,
Ludo’.




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

end of thread, other threads:[~2012-02-22 21:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-19 16:42 manual examples - self contained or not? Ian Price
2012-02-19 17:50 ` Nala Ginrut
2012-02-21 21:14   ` Neil Jerram
2012-02-21 22:04     ` Andy Wingo
2012-02-19 21:02 ` Noah Lavine
2012-02-19 21:18 ` Andy Wingo
2012-02-22 21:35 ` Ludovic Courtès

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 read-only IMAP folder(s) and NNTP newsgroup(s).