-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Adding an intrinsics module #1573
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this actually work?? I'd like to see some tests.
Converting to draft until tested and CI passes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the use of value since that's not how is_reference_type()
and size_of()
are used.
fn is_ref_type<T>(param: T) -> bool { | ||
is_reference_type::<T>() | ||
} | ||
|
||
fn get_size_of<T>(param: T) -> u64 { | ||
size_of::<T>() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if the actual library functions in the intrinsics
module should do this? They seem a bit redundant otherwise. What is the motivation around creating the wrappers in the new module -- to hide the __
prefix?
I guess most intrinsics, like those which will wrap VM opcodes, are not really expected to be exposed to the average dev. They're more for low level library development, and we wouldn't need/want to wrap them. But these are designed for everyday use so sure, let's wrap. But I don't anticipate needing to put anything else in this module particularly..? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to hide the
__
prefix?
Yes, because the alternative is to make the specific names of the intrinsics part of the public API of the language. Which we could certainly do, but then it's one more set of keywords people have to account for.
But I don't anticipate needing to put anything else in this module particularly..?
Can't really think of anything either, but that's fine! Not every intrinsic needs to be available to the end user, as you said.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm in favor of these wrappers to hide the __
prefix. It helps keep a nice uniform api surface for users.
All in the title.
close #1532