Skip to content

Commit

Permalink
deprecate dip function packs
Browse files Browse the repository at this point in the history
  • Loading branch information
kaikalii committed Jun 12, 2024
1 parent 639b47c commit 0ce3026
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
11 changes: 10 additions & 1 deletion src/compile/modifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use super::*;

impl Compiler {
fn desugar_function_pack(
&self,
&mut self,
modifier: &Sp<Modifier>,
operand: Sp<Word>,
) -> UiuaResult<Option<Modified>> {
Expand All @@ -21,6 +21,15 @@ impl Compiler {
};
match &modifier.value {
Modifier::Primitive(Primitive::Dip) => {
self.emit_diagnostic(
format!(
"{} function packs are deprecated and \
will be removed in the future",
Primitive::Dip.format()
),
DiagnosticKind::Warning,
span.clone(),
);
let mut branches = pack.branches.into_iter().rev();
let mut new = Modified {
modifier: modifier.clone(),
Expand Down
6 changes: 0 additions & 6 deletions src/primitive/defs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1637,12 +1637,6 @@ primitive!(
/// ex: [⊃⊙⋅∘(++) 3 5 10]
/// ex: [⊃⋅⊙∘(++) 3 5 10]
/// ex: [⊃⊙∘(++) 3 5 10]
///
/// [dip] is compatible with function packs.
/// It is equivalent to nesting [dip]s.
/// ⚠ Using [dip] in this way is experimental and may change in the future.
/// ex: +⊙(×⊙(↙⊙↘)) 2 10 3 1 [1 2 3 4 5]
/// ex: +⊙(×|↙|↘) 2 10 3 1 [1 2 3 4 5]
([1], Dip, Planet, ("dip", '⊙')),
/// Call a function but keep its first argument on the top of the stack
///
Expand Down
1 change: 0 additions & 1 deletion tests/units.ua
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@
# Dip
⍤⟜≍: [1 5] [⊙+ 1 2 3]
⍤⟜≍: [1 2 7] [⊙⊙+ 1 2 3 4]
⍤⟜≍: [⊙(+⊙(-⊙×)) 1 2 3 4 5] [⊙(+|-|×) 1 2 3 4 5]

# Fork
⍤⟜≍: [8 2] [⊃+- 3 5]
Expand Down

0 comments on commit 0ce3026

Please sign in to comment.