guile-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] Implement doctest utility as guild script


From: Ludovic Courtès
Subject: Re: [PATCH] Implement doctest utility as guild script
Date: Sun, 29 Sep 2013 14:40:56 +0200
User-agent: Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux)

Hi,

Thanks for the patch.

address@hidden skribis:

> +(define (substring-safe str index)
> +    "
> +        Return substring of STR, starting at INDEX,
> +        or empty string, if STR is too short.
> +
> +        +++ (substring-safe \"1234\" 3)
> +        --- \"4\"
> +        +++ (substring-safe \"1234\" 6)
> +        --- \"\"
> +    "
> +    (if (< (string-length str) index)
> +     (string)
> +     (substring str index)))

I share Ian Price’s concerns regarding the fundamental idea behind
doctest.  Namely, writing code in strings means that syntax errors can
only be detected very late, and that the code in there cannot easily
refer to anything outside; furthermore, that pollutes docstrings, whose
goal is to provide a help string for users.

This could be partly addressed by writing sexps instead of strings,
though you would still not have compiler warnings & co.

So I’m not enthusiastic about encouraging this mechanism by
incorporating into Guile.

Thoughts?

Thanks,
Ludo’.




reply via email to

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