New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing docs for how to find the type of a native int #1568
Comments
|
You mean like checking if it's an int32 or something? I think only ^name
can give you that. Native type are really weird.
2017-09-19 19:54 GMT+02:00 Zoffix Znet <notifications@github.com>:
… I think there's some way to ask a variable for what type of native int it
is (maybe something with metamodel?)
Don't see anything mentioned on https://docs.perl6.org/type/nativeInt
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1568>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AMYVf9pI5tcLtv3LsrgdjC1piJ8_Bm6bks5sj__sgaJpZM4Pcx7q>
.
--
Sylvain "Skarsnik" Colinet
Victory was near but the power of the ring couldn't be undone
|
|
I thought there was something, but perhaps it was the It's not working for variables: And I'm a bit surprised even this doesn't work. Gives my @vs := 42, (my int $ = 42), (my int32 $ = 42),
(my int64 $ = 42), (my int16 $ = 42), (my int8 $ = 42);
multi wat (int) { 'int' }
multi wat (int8) { 'int8' }
multi wat (int16) { 'int16' }
multi wat (int32) { 'int32' }
multi wat (int64) { 'int64' }
multi wat (Int) { 'Int' }
.&wat.say for @vs; |
|
Natives don't know their types because they're just values, without any meta-data. And sized natives only matter for storage; all operations are done at full width. So by the time you actually get a native in a position where you could pass it somewhere, it will be full-width anyway, so multi-dispatching over their size won't work out. We might some day be able to make |
|
I see two options here. First, just close the issue, since there is no actual way to find the type of a native type. Second, to add the sentence by @jnthn
|
I think there's some way to ask a variable for what type of native int it is (maybe something with metamodel?)
Don't see anything mentioned on https://docs.perl6.org/type/nativeInt
The text was updated successfully, but these errors were encountered: