aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2022-06-16 04:55:25 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2022-06-16 04:55:25 -0400
commite5615fc5ff0b47c331d97c1eb588ec43d590f0b3 (patch)
treecb3c72ffaa0c82e3c82d840c0174f46b80dbd99d
parent3295d50d33ba6f92185470c2984b097140231618 (diff)
Prevent aliases from being used except at the top level of a ⟨⟩ list
-rw-r--r--commentary/stability.md1
-rw-r--r--docs/commentary/stability.html1
-rw-r--r--src/c.bqn1
-rw-r--r--test/cases/namespace.bqn3
4 files changed, 5 insertions, 1 deletions
diff --git a/commentary/stability.md b/commentary/stability.md
index 548dc7c5..3dfefe47 100644
--- a/commentary/stability.md
+++ b/commentary/stability.md
@@ -9,5 +9,6 @@ I have thousands of lines of running BQN code including the self-hosted sources,
Various edge cases were fixed when I first ran the primitive specifications through unit tests(!) in February 2021. Since then there have been two compatibility breaks, that is, changes from one intentional (i.e. excluding bugs) non-error behavior to a different behavior.
- 2021-08-07: Pick (`⊑`) of empty array and Reshape (`⥊`) of empty array to non-empty changed from using fill elements to errors.
- 2022-05-03: Don't always preserve fill of `𝕩` in structural Under, such as `arr⌾⊢ <fill` to set fill element (was unspecified but intentionally implemented).
+- 2022-06-16: Don't allow aliases within strands (against syntax spec but intentional).
System functions change more frequently. Some system functions are considered stable and others experimental. At the time of writing, the following seems to hold: system functions that are included in two out of three among the specification, JS REPL, and CBQN are stable. Others may or may not be stable; please ask about these on the forums (or by another channel) if you want to rely on them. Stable system functions are still much more likely to change than syntax or primitives. However, before making a change we'll try to find if there's code that relies on them and notify the owner. As this procedure doesn't scale well, if a system function reaches widespread use we'll be unwilling to change it without a strong reason.
diff --git a/docs/commentary/stability.html b/docs/commentary/stability.html
index 66d2b2a8..4d5b1c95 100644
--- a/docs/commentary/stability.html
+++ b/docs/commentary/stability.html
@@ -11,5 +11,6 @@
<ul>
<li>2021-08-07: Pick (<code><span class='Function'>⊑</span></code>) of empty array and Reshape (<code><span class='Function'>⥊</span></code>) of empty array to non-empty changed from using fill elements to errors.</li>
<li>2022-05-03: Don't always preserve fill of <code><span class='Value'>𝕩</span></code> in structural Under, such as <code><span class='Value'>arr</span><span class='Modifier2'>⌾</span><span class='Function'>⊢</span> <span class='Function'>&lt;</span><span class='Value'>fill</span></code> to set fill element (was unspecified but intentionally implemented).</li>
+<li>2022-06-16: Don't allow aliases within strands (against syntax spec but intentional).</li>
</ul>
<p>System functions change more frequently. Some system functions are considered stable and others experimental. At the time of writing, the following seems to hold: system functions that are included in two out of three among the specification, JS REPL, and CBQN are stable. Others may or may not be stable; please ask about these on the forums (or by another channel) if you want to rely on them. Stable system functions are still much more likely to change than syntax or primitives. However, before making a change we'll try to find if there's code that relies on them and notify the owner. As this procedure doesn't scale well, if a system function reaches widespread use we'll be unwilling to change it without a strong reason.</p>
diff --git a/src/c.bqn b/src/c.bqn
index 316617e5..70dac605 100644
--- a/src/c.bqn
+++ b/src/c.bqn
@@ -274,6 +274,7 @@ Parse ← {r‿vn‿i‿e‿def←𝕨⋄nv←≠vn
"Can't nest assignments (write aliases with ⇐)"_err_(ai⊏G) ((5≠ai⊏gac)∧ak=2)<ai⊏aa
"Can't use result of function/modifier assignment without parentheses"_err_(G) hg<(0<er)∧(0≤r)∧»⊸>aa
af>↩alm←ai⊏aa⋄al←alm/ai # aliases al
+ "Aliases can only appear in ⟨⟩ bracketed lists"_err_(al⊏G) ¬al⊏(fo∨𝕩=⊑bB)<○IT lo
ai/˜↩af⋄at/˜↩af∾1¨hj
# Lexical resolution (independent of parsing part 2 below)
diff --git a/test/cases/namespace.bqn b/test/cases/namespace.bqn
index 421c2e3f..ad0974a8 100644
--- a/test/cases/namespace.bqn
+++ b/test/cases/namespace.bqn
@@ -19,7 +19,8 @@
! % ⟨a⇐c⟩←{a⇐5}⋄a
! % ⟨c⇐a⟩←{a⇐5}⋄a
2 % b←{a⇐𝕩}2⋄⟨b⇐a⟩↩b⋄b
-6 % (d⇐b)‿a←{b⇐1+a⇐𝕩}2⋄a×d
+! % (d⇐b)‿a←{b⇐1+a⇐𝕩}2⋄a×d
+6 % ⟨d⇐b,a⟩←{b⇐1+a⇐𝕩}2⋄a×d
! % a2←0⋄⟨a2⇐a⟩+↩{a⇐1}
! % ⟨b⇐c,d⟩←1‿2