unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#30145: [PATCH] doc: Document undefined?.
@ 2018-01-17 17:52 Arun Isaac
       [not found] ` <handler.30145.B.15162115551614.ack@debbugs.gnu.org>
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Arun Isaac @ 2018-01-17 17:52 UTC (permalink / raw)
  To: 30145

* 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






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

* bug#30145: Acknowledgement ([PATCH] doc: Document undefined?.)
       [not found] ` <handler.30145.B.15162115551614.ack@debbugs.gnu.org>
@ 2018-01-18  6:16   ` Arun Isaac
  0 siblings, 0 replies; 6+ messages in thread
From: Arun Isaac @ 2018-01-18  6:16 UTC (permalink / raw)
  To: 30145


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.





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

* bug#30145: [PATCH] doc: Document unspecified?.
  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:20 ` Arun Isaac
  2018-01-21 14:48   ` Mark H Weaver
  2018-01-21 14:33 ` bug#30145: [PATCH] doc: Document undefined? Mark H Weaver
  2 siblings, 1 reply; 6+ messages in thread
From: Arun Isaac @ 2018-01-18  6:20 UTC (permalink / raw)
  To: 30145

* 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






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

* bug#30145: [PATCH] doc: Document undefined?.
  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:20 ` bug#30145: [PATCH] doc: Document unspecified? Arun Isaac
@ 2018-01-21 14:33 ` Mark H Weaver
  2 siblings, 0 replies; 6+ messages in thread
From: Mark H Weaver @ 2018-01-21 14:33 UTC (permalink / raw)
  To: Arun Isaac; +Cc: 30145

Arun Isaac <arunisaac@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





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

* bug#30145: [PATCH] doc: Document unspecified?.
  2018-01-18  6:20 ` bug#30145: [PATCH] doc: Document unspecified? Arun Isaac
@ 2018-01-21 14:48   ` Mark H Weaver
  2018-01-21 18:22     ` Arun Isaac
  0 siblings, 1 reply; 6+ messages in thread
From: Mark H Weaver @ 2018-01-21 14:48 UTC (permalink / raw)
  To: Arun Isaac; +Cc: 30145

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





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

* bug#30145: [PATCH] doc: Document unspecified?.
  2018-01-21 14:48   ` Mark H Weaver
@ 2018-01-21 18:22     ` Arun Isaac
  0 siblings, 0 replies; 6+ messages in thread
From: Arun Isaac @ 2018-01-21 18:22 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: 30145-done

Mark H Weaver <mhw@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.





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

end of thread, other threads:[~2018-01-21 18:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2018-01-21 18:22     ` Arun Isaac
2018-01-21 14:33 ` bug#30145: [PATCH] doc: Document undefined? Mark H Weaver

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).