kopia lustrzana https://github.com/backface/turtlestitch
				
				
				
			more meaningful error messages for list operations
now asserting data types to list operations, due to popular request. This is somewhat sad, because *always* type-asserting *everything* puts a strain on performance and takes away some of the “liveliness”. But I hear you, teachers :-/upd4.1
							rodzic
							
								
									8022d5ccbb
								
							
						
					
					
						commit
						b6159d7b19
					
				| 
						 | 
				
			
			@ -3511,6 +3511,10 @@ Fixes:
 | 
			
		|||
* Objects, GUI: run “When I start as clone” scripts when manually cloning a sprite, only position at hand pointer if no such scripts exist 
 | 
			
		||||
* Morphic, Objects: confine turtle direction readout to 0-360 degrees, thanks, Cynthia for the bug report!!
 | 
			
		||||
 | 
			
		||||
170708
 | 
			
		||||
------
 | 
			
		||||
* Threads: Assert data types to list operations -> meaningful error messages
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Features:
 | 
			
		||||
* polymorphic sprite-local custom blocks
 | 
			
		||||
| 
						 | 
				
			
			@ -3528,10 +3532,12 @@ Features:
 | 
			
		|||
* clones share their original sprite’s scripts, not a shallow-copy of them
 | 
			
		||||
* a highlight-colored balloon indicates the number of active processes per shared script
 | 
			
		||||
* new musical “notes” symbol
 | 
			
		||||
* Assert data types to list operations for more meaningful error messages
 | 
			
		||||
 | 
			
		||||
Fixes:
 | 
			
		||||
* changed keyboard shortcut indicator for “find blocks” to “^”
 | 
			
		||||
* prevent Snap from “hanging” when encountering certain errors in visible stepping 
 | 
			
		||||
* only mark implicit parameters if no formal ones exist
 | 
			
		||||
* optimized thread-launch and script highlighting to a single frame instead of formerly two
 | 
			
		||||
* changed direction attribute of sprites to automatically confine to 0-360 degrees
 | 
			
		||||
* fixed some typos
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										20
									
								
								threads.js
								
								
								
								
							
							
						
						
									
										20
									
								
								threads.js
								
								
								
								
							| 
						 | 
				
			
			@ -61,7 +61,7 @@ StageMorph, SpriteMorph, StagePrompterMorph, Note, modules, isString, copy,
 | 
			
		|||
isNil, WatcherMorph, List, ListWatcherMorph, alert, console, TableMorph,
 | 
			
		||||
TableFrameMorph, ColorSlotMorph, isSnapObject*/
 | 
			
		||||
 | 
			
		||||
modules.threads = '2017-July-04';
 | 
			
		||||
modules.threads = '2017-July-08';
 | 
			
		||||
 | 
			
		||||
var ThreadManager;
 | 
			
		||||
var Process;
 | 
			
		||||
| 
						 | 
				
			
			@ -1627,23 +1627,23 @@ Process.prototype.reportNewList = function (elements) {
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
Process.prototype.reportCONS = function (car, cdr) {
 | 
			
		||||
    // this.assertType(cdr, 'list');
 | 
			
		||||
    this.assertType(cdr, 'list');
 | 
			
		||||
    return new List().cons(car, cdr);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
Process.prototype.reportCDR = function (list) {
 | 
			
		||||
    // this.assertType(list, 'list');
 | 
			
		||||
    this.assertType(list, 'list');
 | 
			
		||||
    return list.cdr();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
Process.prototype.doAddToList = function (element, list) {
 | 
			
		||||
    // this.assertType(list, 'list');
 | 
			
		||||
    this.assertType(list, 'list');
 | 
			
		||||
    list.add(element);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
Process.prototype.doDeleteFromList = function (index, list) {
 | 
			
		||||
    var idx = index;
 | 
			
		||||
    // this.assertType(list, 'list');
 | 
			
		||||
    this.assertType(list, 'list');
 | 
			
		||||
    if (this.inputOption(index) === 'all') {
 | 
			
		||||
        return list.clear();
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -1660,7 +1660,7 @@ Process.prototype.doDeleteFromList = function (index, list) {
 | 
			
		|||
 | 
			
		||||
Process.prototype.doInsertInList = function (element, index, list) {
 | 
			
		||||
    var idx = index;
 | 
			
		||||
    // this.assertType(list, 'list');
 | 
			
		||||
    this.assertType(list, 'list');
 | 
			
		||||
    if (index === '') {
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -1675,7 +1675,7 @@ Process.prototype.doInsertInList = function (element, index, list) {
 | 
			
		|||
 | 
			
		||||
Process.prototype.doReplaceInList = function (index, list, element) {
 | 
			
		||||
    var idx = index;
 | 
			
		||||
    // this.assertType(list, 'list');
 | 
			
		||||
    this.assertType(list, 'list');
 | 
			
		||||
    if (index === '') {
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -1690,7 +1690,7 @@ Process.prototype.doReplaceInList = function (index, list, element) {
 | 
			
		|||
 | 
			
		||||
Process.prototype.reportListItem = function (index, list) {
 | 
			
		||||
    var idx = index;
 | 
			
		||||
    // this.assertType(list, 'list');
 | 
			
		||||
    this.assertType(list, 'list');
 | 
			
		||||
    if (index === '') {
 | 
			
		||||
        return '';
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -1704,12 +1704,12 @@ Process.prototype.reportListItem = function (index, list) {
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
Process.prototype.reportListLength = function (list) {
 | 
			
		||||
    // this.assertType(list, 'list');
 | 
			
		||||
    this.assertType(list, 'list');
 | 
			
		||||
    return list.length();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
Process.prototype.reportListContainsItem = function (list, element) {
 | 
			
		||||
    // this.assertType(list, 'list');
 | 
			
		||||
    this.assertType(list, 'list');
 | 
			
		||||
    return list.contains(element);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Ładowanie…
	
		Reference in New Issue