GNU bug report logs - #30145
[PATCH] doc: Document undefined?.

Previous Next

Package: guile;

Reported by: Arun Isaac <arunisaac <at> systemreboot.net>

Date: Wed, 17 Jan 2018 17:53:02 UTC

Severity: normal

Tags: patch

Done: Arun Isaac <arunisaac <at> systemreboot.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 30145 in the body.
You can then email your comments to 30145 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#30145; Package guile. (Wed, 17 Jan 2018 17:53:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Arun Isaac <arunisaac <at> systemreboot.net>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Wed, 17 Jan 2018 17:53:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: bug-guile <at> gnu.org
Cc: Arun Isaac <arunisaac <at> systemreboot.net>
Subject: [PATCH] doc: Document undefined?.
Date: Wed, 17 Jan 2018 23:22:04 +0530
* doc/ref/data-rep.texi: Document undefined?.
---
 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..ed3a5a522 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} undefined? x
+Return @code{#t} if @var{x} is undefined, else @code{#f}.
+@end deffn
 
 @node Non-immediate objects
 @subsubsection Non-immediate objects
-- 
2.15.1





Information forwarded to bug-guile <at> gnu.org:
bug#30145; Package guile. (Thu, 18 Jan 2018 06:17:02 GMT) Full text and rfc822 format available.

Message #8 received at 30145 <at> debbugs.gnu.org (full text, mbox):

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: 30145 <at> debbugs.gnu.org
Subject: Re: bug#30145: Acknowledgement ([PATCH] doc: Document undefined?.)
Date: Thu, 18 Jan 2018 11:46:20 +0530
I intended to document unspecified?. I have somehow gotten confused and
ended up specifying it as undefined?. Disregard this patch. I will send
a new one.




Information forwarded to bug-guile <at> gnu.org:
bug#30145; Package guile. (Thu, 18 Jan 2018 06:21:02 GMT) Full text and rfc822 format available.

Message #11 received at 30145 <at> debbugs.gnu.org (full text, mbox):

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: 30145 <at> debbugs.gnu.org
Cc: Arun Isaac <arunisaac <at> systemreboot.net>
Subject: [PATCH] doc: Document unspecified?.
Date: Thu, 18 Jan 2018 11:50:29 +0530
* 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
 
 @node Non-immediate objects
 @subsubsection Non-immediate objects
-- 
2.15.1





Information forwarded to bug-guile <at> gnu.org:
bug#30145; Package guile. (Sun, 21 Jan 2018 14:37:02 GMT) Full text and rfc822 format available.

Message #14 received at 30145 <at> debbugs.gnu.org (full text, mbox):

From: Mark H Weaver <mhw <at> netris.org>
To: Arun Isaac <arunisaac <at> systemreboot.net>
Cc: 30145 <at> debbugs.gnu.org
Subject: Re: bug#30145: [PATCH] doc: Document undefined?.
Date: Sun, 21 Jan 2018 09:33:40 -0500
Arun Isaac <arunisaac <at> systemreboot.net> writes:
> * doc/ref/data-rep.texi: Document undefined?.

Is 'undefined?' a procedure in your Guile?  It's not available at my
Guile REPL,and I can't find a single occurrence of 'undefined?' in my
guile stable-2.2 git checkout.

There is a special SCM_UNDEFINED value at the C level, but it's only
used for a couple of internal purposes and not usable from Scheme at
all.

FYI, the two internal purposes are these: (1) if SCM_UNDEFINED is passed
as an optional argument to a Scheme procedure implemented in C, this
indicates that the optional argument was not actually present.  (2) if
SCM_UNDEFINED is stored in a top-level variable object, that indicates
that the variable is no longer bound, i.e. it was actually removed.

       Mark




Information forwarded to bug-guile <at> gnu.org:
bug#30145; Package guile. (Sun, 21 Jan 2018 14:52:01 GMT) Full text and rfc822 format available.

Message #17 received at 30145 <at> debbugs.gnu.org (full text, mbox):

From: Mark H Weaver <mhw <at> netris.org>
To: Arun Isaac <arunisaac <at> systemreboot.net>
Cc: 30145 <at> debbugs.gnu.org
Subject: Re: bug#30145: [PATCH] doc: Document unspecified?.
Date: Sun, 21 Jan 2018 09:48:54 -0500
Hi Arun,

Arun Isaac <arunisaac <at> 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 sent to Arun Isaac <arunisaac <at> systemreboot.net>:
You have taken responsibility. (Sun, 21 Jan 2018 18:23:02 GMT) Full text and rfc822 format available.

Notification sent to Arun Isaac <arunisaac <at> systemreboot.net>:
bug acknowledged by developer. (Sun, 21 Jan 2018 18:23:02 GMT) Full text and rfc822 format available.

Message #22 received at 30145-done <at> debbugs.gnu.org (full text, mbox):

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: Mark H Weaver <mhw <at> netris.org>
Cc: 30145-done <at> debbugs.gnu.org
Subject: Re: bug#30145: [PATCH] doc: Document unspecified?.
Date: Sun, 21 Jan 2018 23:52:08 +0530
Mark H Weaver <mhw <at> netris.org> writes:

About undefined?: That was a typo. I mentioned that in a later message.

> 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?

I agree. I didn't put very much thought into the matter before I sent
the patch. I needed unspecified? for a patch to GNU Guix. I found the
info documentation missing for unspecified? and thought I'll write
it. Later, it turned out unspecified? was not necessary for the Guix
patch after all. But, I had already documented unspecified?. So, I sent
it here.

Anyways, I'll close this bug report.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 19 Feb 2018 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 66 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.