Skip to content
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

feat: log builtin #193

Merged
merged 1 commit into from
Sep 27, 2024
Merged

feat: log builtin #193

merged 1 commit into from
Sep 27, 2024

Conversation

katat
Copy link
Collaborator

@katat katat commented Sep 24, 2024

This is a logging feature to help debugging.

Usage:

let sum = var1 + var2;
log(sum); 

It should print something like:

---log span: Span { filename_id: 1, start: 147, len: 7 }---
typ: Some(Field { constant: false })
mutable: false
cvar: v_2 + v_1

Because it is a builtin function, so it only accesses to the info at compilation time.

It is quite common to check the values behind these variables. So we could record the cell var index at the backend, and print out the relevant witness values when generating witnesses.

@katat katat marked this pull request as draft September 24, 2024 09:50
@mimoo
Copy link
Contributor

mimoo commented Sep 24, 2024

so two things:

  1. I think at some point we'll want a real format syntax like in rust (e.g. log("{sum}"))
  2. we should distinguish debugging runtime value and type information, here it looks more like a log("{}", typeof(sum)) (or perhaps we could have a separate log_type function)

@katat katat marked this pull request as ready for review September 27, 2024 08:11
@katat katat merged commit 19dedf6 into main Sep 27, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants