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

Re: stolen uint's

Thread Previous | Thread Next
From:
ToddAndMargo via perl6-users
Date:
January 29, 2020 01:32
Subject:
Re: stolen uint's
Message ID:
42b2d3d0-06df-63e7-d831-4984a5ae39c6@zoho.com
On 2020-01-28 17:17, Trey Harris wrote:
> On Tue, Jan 28, 2020 at 20:04 ToddAndMargo via perl6-users 
> <perl6-users@perl.org <mailto: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>
>     <mailto: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 used points all the time in Modula2.  And reference pointers in Perl5

> 
>     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”.

I got back 'int' for 'unit'.

> 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.

What?  I am not wanting to crash anything.  he phrase "the unbox type 
is" will do fine.  Gives perfect warning.

> 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.

My misunderstandings

1) I though 'uint' and 'int' were both separate native types.
The manual does state such.

2) I thought 'unit' had a structure that went along with it,
as does a string.  And inside that structure were unicorn
values, such as 'undefined' and 'Nil' as well as its type.

Any chance of an unboxing warning?

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