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 01:18
Subject:
Re: stolen uint's
Message ID:
CALKJ+Es7P4J_Tp-BmymDKcQkMWDPTSqC3LAPwSStXtPTxBVdCg@mail.gmail.com
On Tue, Jan 28, 2020 at 20:04 ToddAndMargo via perl6-users <
perl6-users@perl.org> wrote:

> On 2020-01-28 17:00, Trey Harris wrote:
> > On Tue, Jan 28, 2020 at 19:58 ToddAndMargo via perl6-users
> > <perl6-users@perl.org <mailto:perl6-users@perl.org>> wrote:
> >
> >     On 2020-01-28 16:56, Trey Harris wrote:
> >      > In other words—yes, you want Raku to attempt to provoke a
> >     segmentation
> >      > fault, then recover and tell you whether it faulted or not.
> >
> >     Huh?  I just want to know what the variable actually is.  I
> >     do not wnat to crash anything.
> >
> > Write me a C program to do the equivalent, then, please. You will
> > segfault. If you don’t, then you’re asking a question we might be able
> > to answer.
>
> I can't write in C


Perhaps that’s why you don’t understand. Assembler? COBOL? PL/I? Any
language with pointer arithmetic?

I just want the correct answer back.  If the wrong answer is coming
> back, why even have the function available.


You haven’t shown one example of the “wrong answer… coming back”. You’ve
shown multiple examples of autoboxing. So... you could request Raku add a
pragma or trait that would result in a fatal exception being thrown if
autoboxing occurs. You can already wrap the variable in a class that keeps
the native value immutable so that it can’t be autoboxed.

You can compare a native value to another in a way that will tell you if
the are or aren’t the same. From that last, you could build something
rather crude that created a value of every type you’re interested in,
compared your value to each, and then told you if any matched bit-for-bit,
which might be sufficient for your purposes (which I still don’t
understand)?

But what you *can’t* do is ask what it is without autoboxing it. An
unsigned 32-bit int is just 32 bits that are entirely used to express an
integer—there’s no room to mark what it is, so asking it what it is is
meaningless—and once it’s autoboxed, it’s different than it was before the
autoboxing.

>

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