develooper Front page | perl.perl6.users | Postings from January 2020

Re: stolen uint's

Thread Previous | Thread Next
From:
Trey Harris
Date:
January 29, 2020 18:28
Subject:
Re: stolen uint's
Message ID:
CALKJ+EtpYV_puPrN94VJFa8R218Bz3d8cPPJeZBjJsAeo83LNg@mail.gmail.com
On Wed, Jan 29, 2020 at 13:04 ToddAndMargo via perl6-users <
perl6-users@perl.org> wrote:

> On 2020-01-29 09:19, Trey Harris wrote:
> >
> > The first line of https://docs.raku.org/type/UInt is:
> >  > The `|Int`| is defined as a subset of `|Int|:`
> >
> > How does that not “reflect that UInt is not a unique [type, I assume you
> > meant], but a subset of Int”?
>
> You are correct.  Mumble, mumble.
>
>
>
>
> >     2) that uint is not a native type, but a subset of int.
> >
> >
> > But `uint` is not a subset of `int`; they’re both native types so can’t
> > be subtypes as the constraints would have to hook to the metamodel,
> > which uint and int lack because they’re unboxed. (A “sticker on the
> > “box” is where you write the constraints, if you want to think of it
> > that way.)
>
> So long as it is treated as a subset of int, it is a subset.


“treated as a subset”?

I don’t know what you mean:

```console
> int.does(uint)
False
> uint.does(int)
False
> int.isa(uint)
False
> uint.isa(int)
False
> UInt.does(Int)
True
> Int.does(UInt)
True
> UInt.isa(Int)
True
> Int.isa(UInt)
False
```

If I write:

```
class A { has Int $.value }
class B { has Int $.value where * ≥ 0; }
```

B is not a subset of A. That is the relationship of uint and int—two
distinct types whose values happen to overlap in a way that describes a
subset. Perl isn’t Prolog; a logical relationship between two types is not
a first-class entity of the language.

>

> I know, I am slicing the baloney thin here, but uint is
> not a static C variable. It can change into an int with
> the position of the moon.


I’m STILL waiting for you to show me ONE example of a `uint` turning into
`int`. Not `Int`, via auto-boxing, `int`, via who-knows-what. Either do
that, or stop making the assertion it does that; if you don’t show a
reproducible example, I am going to conclude you are lying if you persist.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About