On Fri, 10 Mar 2017 00:31:58 -0800, sidhe...@gmail.com wrote:
> On Thu, Mar 9, 2017 at 9:17 PM, Brandon Allbery <allber...@gmail.com>
> wrote:
> 
> > On Thu, Mar 9, 2017 at 2:55 PM, Zefram <perl6-bugs-follo...@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


Current behavior:

$ perl6 -e 'say Less.Real'
-1
$ perl6 -e 'say True.Real'
1

(both Ints)

I think this is consistent with how the .Numeric/.Real role "casts"
are used.  I'll dump a long-winded explanation of that in 127019 but
the short form is they get you the narrowest (without losing your
information) compatible (with the particular role you requested) type
which is capable of using the built-in arithmetic candidates.

Classes that already do Numeric behave in a manner consistent
to how a class that does not do Numeric would, because outside of
arithmetic, .Numeric/.Real is most often used as a well-known way
to extract numeric values from a compound class.

Reply via email to