From 0ce30266a921b586ee5ef9d446c6a6b6141e9504 Mon Sep 17 00:00:00 2001 From: Kai Schmidt Date: Wed, 12 Jun 2024 10:37:23 -0700 Subject: [PATCH] deprecate dip function packs --- src/compile/modifier.rs | 11 ++++++++++- src/primitive/defs.rs | 6 ------ tests/units.ua | 1 - 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/compile/modifier.rs b/src/compile/modifier.rs index 10b67973..dc6a7869 100644 --- a/src/compile/modifier.rs +++ b/src/compile/modifier.rs @@ -8,7 +8,7 @@ use super::*; impl Compiler { fn desugar_function_pack( - &self, + &mut self, modifier: &Sp, operand: Sp, ) -> UiuaResult> { @@ -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(), diff --git a/src/primitive/defs.rs b/src/primitive/defs.rs index 4f105bf2..0e80b5c4 100644 --- a/src/primitive/defs.rs +++ b/src/primitive/defs.rs @@ -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 /// diff --git a/tests/units.ua b/tests/units.ua index bd753022..177df4d7 100644 --- a/tests/units.ua +++ b/tests/units.ua @@ -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]