-
Notifications
You must be signed in to change notification settings - Fork 201
New parallel expression in Q#
#3298
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
base: main
Are you sure you want to change the base?
Changes from 10 commits
2071da6
4228eda
732d057
1f2738e
734cf9f
5b53d95
dc711b5
e880df1
f237352
a1d8b0e
5f1d604
db764c9
bcbaab2
bd1e204
39a4783
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -917,6 +917,10 @@ pub enum ExprKind { | |
| Lambda(CallableKind, Box<Pat>, Box<Expr>), | ||
| /// A literal. | ||
| Lit(Box<Lit>), | ||
| /// A parallel expression: `parallel a` | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we want the target expr to be a block to force a scope on the feature rather than allowing any expr?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It gets turned into a block if it isn't one as part of lowering into HIR. But from a user-facing syntax perspective, there is value in having it support any expression. For example, for-loops are an expression, and one of the main motiviations is allowing |
||
| Parallel(Box<Expr>), | ||
|
swernli marked this conversation as resolved.
Outdated
|
||
| /// A parallel-limited expression: `parallel within n a` | ||
| ParallelLimited(Box<Expr>, Box<Expr>), | ||
|
swernli marked this conversation as resolved.
Outdated
|
||
| /// Parentheses: `(a)`. | ||
| Paren(Box<Expr>), | ||
| /// A path: `a` or `a.b`. | ||
|
|
@@ -964,6 +968,10 @@ impl Display for ExprKind { | |
| ExprKind::Interpolate(components) => display_interpolate(indent, components)?, | ||
| ExprKind::Lambda(kind, param, expr) => display_lambda(indent, *kind, param, expr)?, | ||
| ExprKind::Lit(lit) => write!(indent, "Lit: {lit}")?, | ||
| ExprKind::Parallel(e) => write!(indent, "Parallel: {e}")?, | ||
| ExprKind::ParallelLimited(limit, body) => { | ||
| write!(indent, "ParallelLimited: {limit} {body}")?; | ||
|
swernli marked this conversation as resolved.
Outdated
|
||
| } | ||
| ExprKind::Paren(e) => write!(indent, "Paren: {e}")?, | ||
| ExprKind::Path(p) => write!(indent, "Path: {p}")?, | ||
| ExprKind::Range(start, step, end) => { | ||
|
|
||
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.
It is difficult for me to understand what should be expected from the nested
parallel withinexpressions, so I'll double-check with you. Is this correct and what is expected with the nested setup?