Skip Menu |
Report information
Id: 130970
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: zefram [at] fysh.org
Cc:
AdminCc:

Severity: (no value)
Tag: Bug
Platform: (no value)
Patch Status: (no value)
VM: (no value)



To: rakudobug [...] perl.org
From: Zefram <zefram [...] fysh.org>
Subject: [BUG] Set.new confused by Nil
Date: Thu, 9 Mar 2017 20:02:04 +0000
Download (untitled) / with headers
text/plain 381b
Show quoted text
> Set.new(Nil).perl
set(Any) Show quoted text
> set(Nil).perl
set(Any) Show quoted text
> set(Nil).WHICH
Set|Any|U16962232 Attempting to put Nil into a Set instead puts Any into one. Happens with both Set.new() and set() constructors. The .WHICH result shows that it really is the set construction that mangled the value, not .perl. There's no reason for Nil not to be a distinguishable value in a set. -zefram
Date: Thu, 9 Mar 2017 15:12:26 -0500
CC: bugs-bitbucket [...] rt.perl.org
Subject: Re: [perl #130970] [BUG] Set.new confused by Nil
From: Brandon Allbery <allbery.b [...] gmail.com>
To: perl6-compiler <perl6-compiler [...] perl.org>
Download (untitled) / with headers
text/plain 1.2k
Erm. Isn't Nil a silent Failure? Insisting that it be propagated and retained in all circumstances basically asserts that it must be a distinct concrete value, and specifically *not* any form of Failure. Could someone clarify this?

(At present my understanding is that it is a silent Failure and most if not all of today's Nil tickets are at best missing the point.)

On Thu, Mar 9, 2017 at 3:03 PM, Zefram <perl6-bugs-followup@perl.org> wrote:
Show quoted text
# New Ticket Created by  Zefram
# Please include the string:  [perl #130970]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/Ticket/Display.html?id=130970 >


> Set.new(Nil).perl
set(Any)
> set(Nil).perl
set(Any)
> set(Nil).WHICH
Set|Any|U16962232

Attempting to put Nil into a Set instead puts Any into one.  Happens with
both Set.new() and set() constructors.  The .WHICH result shows that
it really is the set construction that mangled the value, not .perl.
There's no reason for Nil not to be a distinguishable value in a set.

-zefram



--
brandon s allbery kf8nh                               sine nomine associates
allbery.b@gmail.com                                  ballbery@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
To: Brandon Allbery via RT <perl6-bugs-followup [...] perl.org>
From: Zefram <zefram [...] fysh.org>
Subject: Re: [perl #130970] [BUG] Set.new confused by Nil
Date: Thu, 9 Mar 2017 20:55:15 +0000
Download (untitled) / with headers
text/plain 1.1k
Brandon Allbery via RT wrote: Show quoted text
>Erm. Isn't Nil a silent Failure?
It may well represent such a thing, but it is also a reified object. Putting objects into sets is an operation that's applicable to any kind of object, and which (for comparison) does in fact work on objects of the Failure class. Expecting an object to be propagated doesn't assert that it doesn't represent failure; rather, it's just embracing the reification. The great benefit of reification is that the object can be processed in all the familiar ways that are used on ordinary value objects. If you want to impose a restriction that failure objects can't go into some of the places I've tried to put Nil, then in some cases that would be a sensible decision. It would make perfect sense to restrict Range endpoints, for example, but it doesn't make any sense to restrict the domain of Sets. But in any case, wherever such a restriction is desirable it should be enforced by signalling an exception: silently substituting a different value sucks. And if your logic for rejecting Nil is that it represents failure, then presumably the same logic would lead you to reject objects of the Failure class too, and maybe also Exception. -zefram


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org