You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Maybe using an escape character or a dedicated method to make this possible?
Bug
letname: Quoted = func.name();
letstruct_name_based_on_fn_name = quote { $name_suffix }; // this doesn't work, since the var name is now name_suffixletstruct_name_based_on_fn_name = name.append(quote {_suffix}); // this is parsed as separate tokens
Those examples should be allowed somehow
To Reproduce
No response
Workaround
Yes
Workaround Description
As a hacky workaround, I implemented the following builtin for the Quoted struct:
# Description
## Problem
Resolves#5899Resolves#5914
## Summary
Two things here:
1. When interpolating quotes values inside a format string, we do that
without producing the `quote {` and `}` parts, which is likely what a
user would expect (similar to unquoting those values).
2. In order to create identifiers (or any piece of code in general) by
joining severa quoted values you can use format strings together with
the new `fmtstr::contents` method, which returns a `Quoted` value with
the string contents (that is, without the leading and trailing double
quotes).
## Additional Context
I originally thought about a method like `fmtstr::as_identifier` that
would try to parse the string contents as an identifier (maybe an
`Ident`, or maybe a `Path`), returning `Option<Quoted>` and `None` in
case it couldn't be parsed to that. But I think in general it could be
more useful to just get the string contents as a `Quoted` value. After
all, if it isn't an identifier you'll learn it later on once the value
is unquoted or interpolated.
## Documentation
Check one:
- [ ] No documentation needed.
- [x] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.
# PR Checklist
- [x] I have tested the changes locally.
- [x] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
Aim
Using the unquote operator as part of identifiers
Expected Behavior
Maybe using an escape character or a dedicated method to make this possible?
Bug
Those examples should be allowed somehow
To Reproduce
No response
Workaround
Yes
Workaround Description
As a hacky workaround, I implemented the following builtin for the
Quoted
struct:Additional Context
No response
Project Impact
Blocker
Blocker Context
No response
Nargo Version
No response
NoirJS Version
No response
Proving Backend Tooling & Version
No response
Would you like to submit a PR for this Issue?
None
Support Needs
No response
The text was updated successfully, but these errors were encountered: