refactored toggling APL-scalars support on and off

pull/95/head
jmoenig 2020-06-24 10:38:15 +02:00
rodzic 3fb5a0721d
commit 87096d6d39
2 zmienionych plików z 20 dodań i 17 usunięć

Wyświetl plik

@ -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',

Wyświetl plik

@ -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) {