-
Notifications
You must be signed in to change notification settings - Fork 97
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
Builtin functions. #920
Builtin functions. #920
Conversation
a20d591
to
896ea2e
Compare
/// This is a built-in function taking a string argument and terminating | ||
/// evaluation unsuccessfully with this argument as explanation. | ||
/// This symbol is not an empty array, the actual semantics are overridden. | ||
let panic = []; |
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.
This is quite confusing
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.
The main other way I could think of is something like:
std::core:
let builtin = |name| (); // The only weird thing
std::check:
let panic = std::core::builtin("panic");
And then builtin
would be the only real builtin function.
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.
although this would not pass strict type checking
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.
ok, we could use something like let panic = std::core::builtin::<"panic">();
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.
if it's already built-in, why not make it fully built-in?
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.
so we keep it like this for now?
/// This is a built-in function taking an array argument and returning | ||
/// the length of the array. | ||
/// This symbol is not an empty array, the actual semantics are overridden. | ||
let len = []; |
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.
This is also confusing. Why is it done like this?
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.
If I just use let len;
, then it will be a witness column. I have to assign something.
Although thinking about it, maybe it could work?
But in any case, since we don't have any annotations or stuff like this, it has to be weird in some way.
521a4e0
to
fba1089
Compare
if you rebase circle vanishes :D |
rebased |
pil_analyzer/src/evaluator.rs
Outdated
@@ -130,12 +137,27 @@ impl<'a, T: FieldElement, C: Custom> Value<'a, T, C> { | |||
format!("[{}]", elements.iter().map(|e| e.type_name()).format(", ")) | |||
} | |||
Value::Closure(c) => c.type_name(), | |||
Value::BuiltinFunction(b) => format!("builtin{b:?}"), |
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.
maybe "builtin::{b:?}"
?
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.
Actually this should usually be the type name of a closure. Let me make it proper.
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.
ok, turns out we don't even know the types in a closure.
What about builtin_
? I don't particularly like ::
because it is not a namespace.
As soon as we add proper types, this will be replaced anyway.
No description provided.