unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Mark H Weaver <mhw@netris.org>
To: Arun Isaac <arunisaac@systemreboot.net>
Cc: 30145@debbugs.gnu.org
Subject: bug#30145: [PATCH] doc: Document unspecified?.
Date: Sun, 21 Jan 2018 09:48:54 -0500	[thread overview]
Message-ID: <87wp0bmfmx.fsf@netris.org> (raw)
In-Reply-To: <20180118062029.5655-1-arunisaac@systemreboot.net> (Arun Isaac's message of "Thu, 18 Jan 2018 11:50:29 +0530")

Hi Arun,

Arun Isaac <arunisaac@systemreboot.net> writes:

> * doc/ref/data-rep.texi: Document unspecified?.
> ---
>  doc/ref/data-rep.texi | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/doc/ref/data-rep.texi b/doc/ref/data-rep.texi
> index bb7f74afe..f179a3560 100644
> --- a/doc/ref/data-rep.texi
> +++ b/doc/ref/data-rep.texi
> @@ -470,6 +470,9 @@ check to see if @var{x} is @code{SCM_UNBOUND}.  History will not be kind
>  to us.
>  @end deftypefn
>  
> +@deffn {Scheme Procedure} unspecified? x
> +Return @code{#t} if @var{x} is unspecified, else @code{#f}.
> +@end deffn

I'm not sure it's a good idea to document this procedure as part of our
public API, but if we were to document it, it would require a more
informative description.

It's nonsensical to ask whether a given object is "unspecified".  When
the Scheme standards say that the result of a computation is an
unspecified value, that means that *any* Scheme object could be
returned.

In Guile, for historical reasons, we usually return a particular object
SCM_UNSPECIFIED (a.k.a. *unspecified*) in cases where the specification
says that the result is unspecified.  However, we make no promises that
this will remain the case in future versions of Guile.

The number of legitimate uses for 'unspecified?' is extremely small.  In
fact, I can think of only one: when a REPL prints the result of a user's
computation, it is nice to avoid printing "*unspecified*" and instead
print nothing in that case.

In almost every other case, use of 'unspecified?' implies an assumption
that it's possible to detect when a value is an "unspecified" value,
when in fact that is fundamentally impossible.

What do you think?

      Mark





  reply	other threads:[~2018-01-21 14:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-17 17:52 bug#30145: [PATCH] doc: Document undefined? Arun Isaac
     [not found] ` <handler.30145.B.15162115551614.ack@debbugs.gnu.org>
2018-01-18  6:16   ` bug#30145: Acknowledgement ([PATCH] doc: Document undefined?.) Arun Isaac
2018-01-18  6:20 ` bug#30145: [PATCH] doc: Document unspecified? Arun Isaac
2018-01-21 14:48   ` Mark H Weaver [this message]
2018-01-21 18:22     ` Arun Isaac
2018-01-21 14:33 ` bug#30145: [PATCH] doc: Document undefined? Mark H Weaver

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wp0bmfmx.fsf@netris.org \
    --to=mhw@netris.org \
    --cc=30145@debbugs.gnu.org \
    --cc=arunisaac@systemreboot.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).