From 87096d6d39b299e6f3c7662eea2d815c0f5965e4 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Wed, 24 Jun 2020 10:38:15 +0200 Subject: [PATCH] refactored toggling APL-scalars support on and off --- src/gui.js | 18 ++---------------- src/threads.js | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/gui.js b/src/gui.js index 28bfe8d0..937f1c16 100644 --- a/src/gui.js +++ b/src/gui.js @@ -78,7 +78,7 @@ Animation, BoxMorph, BlockEditorMorph, BlockDialogMorph, Note*/ // Global stuff //////////////////////////////////////////////////////// -modules.gui = '2020-June-22'; +modules.gui = '2020-June-24'; // Declarations @@ -3440,21 +3440,7 @@ IDE_Morph.prototype.settingsMenu = function () { if (Process.prototype.enableHyperOps) { addPreference( 'APL-style scalars', - () => { - Process.prototype.enableAPLscalars = - !Process.prototype.enableAPLscalars; - if (Process.prototype.enableAPLscalars) { - Process.prototype.hyperDyadic = - Process.prototype.hyperDyadicAPL; - Process.prototype.hyperZip = - Process.prototype.hyperZipAPL; - } else { - Process.prototype.hyperDyadic = - Process.prototype.hyperDyadicSimple; - Process.prototype.hyperZip = - Process.prototype.hyperZipSimple; - } - }, + () => Process.prototype.toggleAPLscalars(), Process.prototype.enableAPLscalars, 'uncheck to disable treating (nested)\n' + 'single-item lists as scalars', diff --git a/src/threads.js b/src/threads.js index d7b401b9..e579c00a 100644 --- a/src/threads.js +++ b/src/threads.js @@ -61,7 +61,7 @@ StageMorph, SpriteMorph, StagePrompterMorph, Note, modules, isString, copy, Map, isNil, WatcherMorph, List, ListWatcherMorph, alert, console, TableMorph, Color, TableFrameMorph, ColorSlotMorph, isSnapObject, newCanvas, Symbol, SVG_Costume*/ -modules.threads = '2020-June-22'; +modules.threads = '2020-June-24'; var ThreadManager; var Process; @@ -3735,6 +3735,23 @@ Process.prototype.examine = function (data) { return meta; }; +Process.prototype.toggleAPLscalars = function () { +/* + very experimental. I don't like it and mark this feature for + removal. treating (even deep) single-item lists as scalars + must be a misfeature in APL introduced for convenience or to + work around some obvious design flaw. -jens +*/ + Process.prototype.enableAPLscalars = !Process.prototype.enableAPLscalars; + if (Process.prototype.enableAPLscalars) { + Process.prototype.hyperDyadic = Process.prototype.hyperDyadicAPL; + Process.prototype.hyperZip = Process.prototype.hyperZipAPL; + } else { + Process.prototype.hyperDyadic = Process.prototype.hyperDyadicSimple; + Process.prototype.hyperZip = Process.prototype.hyperZipSimple; + } +}; + // Process math primtives - arithmetic Process.prototype.reportSum = function (a, b) {