Array notation design considerations: Difference between revisions

Jump to navigation Jump to search
m
(→‎2016: Corrected factually incorrect assertion: "Again, the notation was only described as a serialisation format; not as an integral part of the language.")
 
(4 intermediate revisions by the same user not shown)
Line 66: Line 66:


Value expressions could be evaluated in the newly established namespace (similar to expressions in <syntaxhighlight lang=apl inline>:Namespace</syntaxhighlight> scripts), or in the surrounding scope (similar to inline expressions in [[wikipedia:JavaScript|JavaScript]]'s object notation). It was envisioned that a main usage of the literal notation would be to collect existing values into a namespace, and evaluating inside the new namespace would force the use of <syntaxhighlight lang=apl inline>##.</syntaxhighlight> to fetch values in the surrounding scope. In a departure from JavaScript, it was found most natural that such intermediate assignments be local to the value expression, similar to assignments in dfns. Global assignment is still available using <syntaxhighlight lang=apl inline>⎕THIS.name←value</syntaxhighlight>, just as in dfns.
Value expressions could be evaluated in the newly established namespace (similar to expressions in <syntaxhighlight lang=apl inline>:Namespace</syntaxhighlight> scripts), or in the surrounding scope (similar to inline expressions in [[wikipedia:JavaScript|JavaScript]]'s object notation). It was envisioned that a main usage of the literal notation would be to collect existing values into a namespace, and evaluating inside the new namespace would force the use of <syntaxhighlight lang=apl inline>##.</syntaxhighlight> to fetch values in the surrounding scope. In a departure from JavaScript, it was found most natural that such intermediate assignments be local to the value expression, similar to assignments in dfns. Global assignment is still available using <syntaxhighlight lang=apl inline>⎕THIS.name←value</syntaxhighlight>, just as in dfns.
After publication of the formal proposal,<ref name=formprop/> Peter Mikkelsen, a then recently hired [[Dyalog Ltd]] employee<ref>[[Dyalog Ltd]]. [https://www.dyalog.com/meet-team-dyalog.htm#Peter Meet Teem Dyalog: Peter]. Retrieved May 2nd, 2023.</ref>, pointed out an inconsistency between value expressions in namespace and vector notation:
<syntaxhighlight lang=apl inline>g←1 ⋄ (a:g←2 ⋄ b:g)</syntaxhighlight> would make <syntaxhighlight lang=apl inline>(a:2 ⋄ b:1)</syntaxhighlight> but <syntaxhighlight lang=apl inline>g</syntaxhighlight> remains <syntaxhighlight lang=apl inline>1</syntaxhighlight>
while
<syntaxhighlight lang=apl inline>g←1 ⋄ (g←2 ⋄ g)</syntaxhighlight> would make <syntaxhighlight lang=apl inline>(2 ⋄ 2)</syntaxhighlight> updating <syntaxhighlight lang=apl inline>g</syntaxhighlight> to be <syntaxhighlight lang=apl inline>2</syntaxhighlight>.
Because of this, the specification was changed on May 5, 2023 to follow JavaScript; that assignments inside value expressions then affect the surrounding scope. Auto-localisation of temporary variables used in building the value can then be achieved by wrapping the expression in an anonymous [[dfn]].


== Timeline ==
== Timeline ==
Line 119: Line 129:


[[APL Germany]]'s 2020 journal also included a description of the notation, including a discussion of potential issues with [[assignment]].<ref>Brudzewsky, Adám. [https://apl-germany.de/wp-content/uploads/2021/11/APL_Journal_2020_1u2.pdf#page=34 A Notation for APL Arrays]. APL-Journal, Volume 2020, number 1-2. [[APL Germany|APL-Germany e.V.]] 2020.</ref>
[[APL Germany]]'s 2020 journal also included a description of the notation, including a discussion of potential issues with [[assignment]].<ref>Brudzewsky, Adám. [https://apl-germany.de/wp-content/uploads/2021/11/APL_Journal_2020_1u2.pdf#page=34 A Notation for APL Arrays]. APL-Journal, Volume 2020, number 1-2. [[APL Germany|APL-Germany e.V.]] 2020.</ref>
===2021===
At [[Dyalog '21]], [[Morten Kromberg]] implied that comunity feedback would have been solicited, and implementation would begin in time for [[Dyalog APL 19.0]]. However, this proved a bit optimistic.<ref>Kromberg, Morten. [https://www.youtube.com/watch?2dQr58vcUjM&t=1688s The Road Ahead].  [[Dyalog '21]]. October 10, 2022.</ref>
[[File:D02 The Road Ahead - Literal Array Notation.png|thumb|right|Array notation at [[Dyalog '22]]]]
===2022===
At [[Dyalog '22]], Morten Kromberg announced that Dyalog Ltd was close to having the notation working.<ref>Kromberg, Morten. [https://www.youtube.com/watch?C6E3mSYSGJ&t=1144s The Road Ahead].  [[Dyalog '22]]. October 10, 2022.</ref>
===2023===
On April 21, 2023, Dyalog Ltd published a blog post by Morten Kromberg announcing to the [[community]] the formal proposal for an APL array notation.<ref name=formprop>Kromberg, Morten. [https://www.dyalog.com/blog/2023/04/formal-proposal-for-apl-array-notation-seeking-feedback/ Formal Proposal for APL Array Notation – Seeking Feedback]. Formal Proposal for APL Array Notation – Seeking Feedback. April 21, 2023.</ref>
On May 5, 2023, the specification for scoping in namespaces was changed due to feedback from Dyalog Ltd employee Peter Mikkelsen. Assignments inside value expressions would now affect the surrounding scope rather than having [[dfn]]-like auto-localisation, which can instead be achieved by wrapping the expression in an anonymous dfn.


{{Template:Comparison of array notations}}
{{Template:Comparison of array notations}}

Navigation menu