Skip to content

Commit 0ce3026

Browse files
committed
deprecate dip function packs
1 parent 639b47c commit 0ce3026

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

src/compile/modifier.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use super::*;
88

99
impl Compiler {
1010
fn desugar_function_pack(
11-
&self,
11+
&mut self,
1212
modifier: &Sp<Modifier>,
1313
operand: Sp<Word>,
1414
) -> UiuaResult<Option<Modified>> {
@@ -21,6 +21,15 @@ impl Compiler {
2121
};
2222
match &modifier.value {
2323
Modifier::Primitive(Primitive::Dip) => {
24+
self.emit_diagnostic(
25+
format!(
26+
"{} function packs are deprecated and \
27+
will be removed in the future",
28+
Primitive::Dip.format()
29+
),
30+
DiagnosticKind::Warning,
31+
span.clone(),
32+
);
2433
let mut branches = pack.branches.into_iter().rev();
2534
let mut new = Modified {
2635
modifier: modifier.clone(),

src/primitive/defs.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1637,12 +1637,6 @@ primitive!(
16371637
/// ex: [⊃⊙⋅∘(++) 3 5 10]
16381638
/// ex: [⊃⋅⊙∘(++) 3 5 10]
16391639
/// ex: [⊃⊙∘(++) 3 5 10]
1640-
///
1641-
/// [dip] is compatible with function packs.
1642-
/// It is equivalent to nesting [dip]s.
1643-
/// ⚠ Using [dip] in this way is experimental and may change in the future.
1644-
/// ex: +⊙(×⊙(↙⊙↘)) 2 10 3 1 [1 2 3 4 5]
1645-
/// ex: +⊙(×|↙|↘) 2 10 3 1 [1 2 3 4 5]
16461640
([1], Dip, Planet, ("dip", '⊙')),
16471641
/// Call a function but keep its first argument on the top of the stack
16481642
///

tests/units.ua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@
127127
# Dip
128128
⍤⟜≍: [1 5] [⊙+ 1 2 3]
129129
⍤⟜≍: [1 2 7] [⊙⊙+ 1 2 3 4]
130-
⍤⟜≍: [⊙(+⊙(-⊙×)) 1 2 3 4 5] [⊙(+|-|×) 1 2 3 4 5]
131130

132131
# Fork
133132
⍤⟜≍: [8 2] [⊃+- 3 5]

0 commit comments

Comments
 (0)