Front page | perl.perl6.users |
Postings from January 2020
Re: stolen uint's
Thread Previous
|
Thread Next
From:
ToddAndMargo via perl6-users
Date:
January 30, 2020 02:08
Subject:
Re: stolen uint's
Message ID:
161a0f32-805a-c72f-b8ca-3bd028df1652@zoho.com
On 2020-01-29 17:45, Trey Harris wrote:
>
>
> On Wed, Jan 29, 2020 at 20:20 ToddAndMargo via perl6-users
> <perl6-users@perl.org <mailto:perl6-users@perl.org>> wrote:
>
> On 2020-01-29 10:28, Trey Harris wrote:
> > 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.
>
> $ p6 'my uint8 $u; say $u.^name;'
> Int
>
> I’m done. I haven’t killfiled anyone in over twenty years.
> Congratulations, you’re the first this century.
#!/usr/bin/env perl6
use NativeCall;
constant BYTE := uint8;
constant BYTES := CArray[BYTE];
my BYTES $lpBuffer = CArray[BYTE].new( 0xFF xx 4 );
if $lpBuffer[0] == -1 { say "$lpBuffer[0] acts like an integer"; }
elsif $lpBuffer[0] == 0xFF { say "$lpBuffer[0] acts like an unsigned
integer"; }
else { say $lpBuffer[0], " unknown"; }
-1 acts like an integer
Thread Previous
|
Thread Next