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

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

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



To: rakudobug [...] perl.org
From: Zefram <zefram [...] fysh.org>
Subject: [LTA] more inconsistent coercions for Bool
Date: Thu, 9 Mar 2017 19:54:47 +0000
Download (untitled) / with headers
text/plain 300b
On the same lines as [perl #127019], the Bool.Real coercion is surprisingly inconsistent with Bool.Int and Bool.Numeric: Show quoted text
> True.^does(Real)
True Show quoted text
> True.^does(Numeric)
True Show quoted text
> True.^isa(Int)
1 Show quoted text
> True.Real
True Show quoted text
> True.Numeric
1 Show quoted text
> True.Int
1 The same goes for coercions from other enum types. -zefram
CC: bugs-bitbucket [...] rt.perl.org
Date: Thu, 9 Mar 2017 15:17:36 -0500
From: Brandon Allbery <allbery.b [...] gmail.com>
Subject: Re: [perl #130969] [LTA] more inconsistent coercions for Bool
To: perl6-compiler <perl6-compiler [...] perl.org>
Download (untitled) / with headers
text/plain 602b

On Thu, Mar 9, 2017 at 2:55 PM, Zefram <perl6-bugs-followup@perl.org> wrote:
Show quoted text
The same goes for coercions from other enum types.

This should be your hint. Enums *are* numeric, specifically Int.
I don't know what language you are trying to force Perl 6 to be, but you might want to consider the possibility that Perl 6 is not that language but instead is Perl 6.

--
brandon s allbery kf8nh                               sine nomine associates
allbery.b@gmail.com                                  ballbery@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
Date: Thu, 9 Mar 2017 20:41:23 +0000
To: Brandon Allbery via RT <perl6-bugs-followup [...] perl.org>
Subject: Re: [perl #130969] [LTA] more inconsistent coercions for Bool
From: Zefram <zefram [...] fysh.org>
Download (untitled) / with headers
text/plain 1.2k
Brandon Allbery via RT wrote: Show quoted text
>This should be your hint. Enums *are* numeric, specifically Int.
I'm aware of that, and that's why I call this an LTA rather than a bug, and why I didn't say conclusively which coercion was wrong. Indeed, on the basis of the enum/Int subclassing, I proposed in [perl #127019] that the inconsistency that then existed between Bool.Int and Bool.Numeric coercions ought to be resolved by making both return the operand unchanged. The decision was made the other way, that they should both return a basal Int. So I'm not saying in this ticket that it's a priori wrong for True.Real to return True. On the contrary, the fact that True.^does(Real) makes that a priori a reasonable answer. The problem is that it's inconsistent with the results for the similar .Int and .Numeric coercions, and with the decision on those coercions that was made in [perl #127019]. There are two ways in which these coercions can be made mutually consistent, and either would resolve this ticket. Show quoted text
>I don't know what language you are trying to force Perl 6 to be,
I'd like it to be a self-consistent language, as far as possible. I don't recall anyone saying yet that that's an undesirable principle in the design of Perl 6. -zefram
CC: Brandon Allbery via RT <perl6-bugs-followup [...] perl.org>
Date: Thu, 9 Mar 2017 15:44:34 -0500
To: Zefram <zefram [...] fysh.org>
From: Brandon Allbery <allbery.b [...] gmail.com>
Subject: Re: [perl #130969] [LTA] more inconsistent coercions for Bool
Self-consistency is itself a fuzzy concept.

In any case I am specifically thinking of a discussion recently in IRC which went over why at least some of this is actually self-consistent *for perl 6*. I may be able to dig it up again, or hopefully someone else already has it on tap.

(That said, there may actually be some lingering inconsistency left over from when Bool had to be special-cased because it needed to exist in the setting before Enums could be defined.)

On Thu, Mar 9, 2017 at 3:41 PM, Zefram <zefram@fysh.org> wrote:
Show quoted text
Brandon Allbery via RT wrote:
>This should be your hint. Enums *are* numeric, specifically Int.

I'm aware of that, and that's why I call this an LTA rather than
a bug, and why I didn't say conclusively which coercion was wrong.
Indeed, on the basis of the enum/Int subclassing, I proposed in [perl
#127019] that the inconsistency that then existed between Bool.Int and
Bool.Numeric coercions ought to be resolved by making both return the
operand unchanged.  The decision was made the other way, that they should
both return a basal Int.

So I'm not saying in this ticket that it's a priori wrong for True.Real
to return True.  On the contrary, the fact that True.^does(Real) makes
that a priori a reasonable answer.  The problem is that it's inconsistent
with the results for the similar .Int and .Numeric coercions, and with the
decision on those coercions that was made in [perl #127019].  There are
two ways in which these coercions can be made mutually consistent,
and either would resolve this ticket.

>I don't know what language you are trying to force Perl 6 to be,

I'd like it to be a self-consistent language, as far as possible.
I don't recall anyone saying yet that that's an undesirable principle
in the design of Perl 6.

-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>
Subject: Re: [perl #130969] [LTA] more inconsistent coercions for Bool
From: Zefram <zefram [...] fysh.org>
Date: Thu, 9 Mar 2017 21:04:15 +0000
Download (untitled) / with headers
text/plain 588b
Brandon Allbery via RT wrote: Show quoted text
>In any case I am specifically thinking of a discussion recently in IRC >which went over why at least some of this is actually self-consistent *for >perl 6*.
I would be interested in seeing that discussion. Show quoted text
>(That said, there may actually be some lingering inconsistency left over >from when Bool had to be special-cased
I haven't noticed any such inconsistency between Bool and other enums. That's certainly not the cause of the present inconsistent coercions, which happen equally with Order: Show quoted text
> Less.Int
-1 Show quoted text
> Less.Real
Less Show quoted text
> Less.Numeric
-1 -zefram
CC: Brandon Allbery via RT <perl6-bugs-followup [...] perl.org>
Date: Thu, 9 Mar 2017 17:18:05 -0500
To: Zefram <zefram [...] fysh.org>
Subject: Re: [perl #130969] [LTA] more inconsistent coercions for Bool
From: Brandon Allbery <allbery.b [...] gmail.com>
The discussion I'm thinking of starts around here: http://colabti.org/irclogger/irclogger_log/perl6?date=2017-03-04#l1490

On Thu, Mar 9, 2017 at 4:04 PM, Zefram <zefram@fysh.org> wrote:
Show quoted text
Brandon Allbery via RT wrote:
>In any case I am specifically thinking of a discussion recently in IRC
>which went over why at least some of this is actually self-consistent *for
>perl 6*.

I would be interested in seeing that discussion.

>(That said, there may actually be some lingering inconsistency left over
>from when Bool had to be special-cased

I haven't noticed any such inconsistency between Bool and other enums.
That's certainly not the cause of the present inconsistent coercions,
which happen equally with Order:

> Less.Int
-1
> Less.Real
Less
> Less.Numeric
-1

-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 <allbery.b [...] gmail.com>
Subject: Re: [perl #130969] [LTA] more inconsistent coercions for Bool
From: The Sidhekin <sidhekin [...] gmail.com>
Date: Thu, 9 Mar 2017 21:36:59 +0100
CC: perl6-compiler <perl6-compiler [...] perl.org>, bugs-bitbucket [...] rt.perl.org
Download (untitled) / with headers
text/plain 564b

On Thu, Mar 9, 2017 at 9:17 PM, Brandon Allbery <allbery.b@gmail.com> wrote:
Show quoted text
On Thu, Mar 9, 2017 at 2:55 PM, Zefram <perl6-bugs-followup@perl.org> wrote:
The same goes for coercions from other enum types.

This should be your hint. Enums *are* numeric, specifically Int.
I don't know what language you are trying to force Perl 6 to be, but you might want to consider the possibility that Perl 6 is not that language but instead is Perl 6.

  I need another hint.

  How does that explain that True.Real is True, while True.Int is 1?


Eirik


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