Skip to content

Conversation

@yonas
Copy link

@yonas yonas commented Jan 3, 2026

Fixes #1062

@yonas yonas force-pushed the feat/pipeline-operator branch 2 times, most recently from 0d47614 to 2f5c842 Compare January 3, 2026 22:43
@yonas yonas force-pushed the feat/pipeline-operator branch from 2f5c842 to 3dd6cc5 Compare January 3, 2026 22:47
}

// Range iterator with step
#[derive(Clone, Hash, Eq, PartialEq)]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove the derive attributes?

#[cfg(not(feature = "no_module"))]
let (_index, name, namespace, _hash) = x;
#[cfg(feature = "no_module")]
let (index, name) = x;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI seems to complain about index being unused here...


Expr::FnCall(fn_call.into(), pos)
}
_ => op_base.into_fn_call_expr(pos),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'd need parsing errors if the stuff following the operator is not a proper function call, instead of allowing it to go through.


Precedence::new(match self {
Or | XOr | Pipe => 30,
Or | XOr | Pipe | PipeArrow => 30,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a lower precedence for |>?

}
('|', '>') => {
stream.eat_next_and_advance(pos);
return (Token::Reserved(Box::new("|>".into())), start_pos);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to be careful here... some users may depend on the fact that |> is a reserved symbol and define it as a custom operator. This may break code, but I see that you're checking this after checking for custom operators...

name: self.get_interned_string(&op),
hashes: FnCallHashes::from_native_only(hash),
args: IntoIterator::into_iter([root, rhs]).collect(),
args: IntoIterator::into_iter([root.clone(), rhs.clone()]).collect(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also is it necessary to clone the arguments?

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.

[ feature request ] Add the pipeline operator |> for chained method calls

2 participants