cleanup and notes...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2018-09-05 04:39:42 +03:00
parent 9e76bf867b
commit 02e4b90418
2 changed files with 6 additions and 18 deletions

19
diff.js
View File

@ -29,6 +29,7 @@ var MIN_TEXT_LENGTH = 100
// - revise architecture... // - revise architecture...
// - merge Types and Diff // - merge Types and Diff
// - cmp(..) / diff(..) / patch(..) to use Diff(..) // - cmp(..) / diff(..) / patch(..) to use Diff(..)
//
// - revise name -- this contains two parts: // - revise name -- this contains two parts:
// 1. diff / patch and friends // 1. diff / patch and friends
// 2. cmp and patterns // 2. cmp and patterns
@ -36,29 +37,19 @@ var MIN_TEXT_LENGTH = 100
// ig-diff // ig-diff
// cdiff // cdiff
// pattern diff // pattern diff
//
// we need the name to be short and descriptive, possible // we need the name to be short and descriptive, possible
// candidates: // candidates:
// - objdiff / object-diff // - objdiff / object-diff
// - diffcmp / diff-cmp // - diffcmp / diff-cmp
// - compare // - compare
//
// - revise docs... // - revise docs...
// ...should be simpler to enter, maybe example-oriented intro // ...should be simpler to enter, maybe example-oriented intro
//
// - diff visualization -- for example see: // - diff visualization -- for example see:
// https://www.npmjs.com/package/jsondiffpatch // https://www.npmjs.com/package/jsondiffpatch
// - experiment with pattern contexts...
// a context is essentially a namespace for a pattern within a
// specific use instance.
// this would enable us to create a settable/linkable named
// pattern that would:
// - until first successful match use pattern to compare
// - set on first successful match
// - subsequent matches would compare to the set value
// //
// NAMED(<name>[, pattern]) // - diff compatibility checking...
//
// this would also require a means to pass the context to
// nested patterns and to access it...
// //
// //
// //
@ -71,7 +62,6 @@ var MIN_TEXT_LENGTH = 100
// zip(func, array, array, ...) // zip(func, array, array, ...)
// -> [func(i, [item, item, ...]), ...] // -> [func(i, [item, item, ...]), ...]
// //
// XXX revise -- is this too complicated???
var zip = function(func, ...arrays){ var zip = function(func, ...arrays){
var i = arrays[0] instanceof Array ? 0 : arrays.shift() var i = arrays[0] instanceof Array ? 0 : arrays.shift()
if(func instanceof Array){ if(func instanceof Array){
@ -2543,5 +2533,6 @@ function(pattern, obj){
/********************************************************************** /**********************************************************************
* vim:set ts=4 sw=4 : */ return module }) * vim:set ts=4 sw=4 : */ return module })

View File

@ -27,8 +27,7 @@ var {
// //
// XXX need better mismatch checking -- ideally stating the exact spot // XXX need better mismatch checking -- ideally stating the exact spot
// where we did not match and the path of fails it created... // where we did not match and the path of fails it created...
// XXX idea: would be nice to be able to use patterns to extract values //
// from structures (parsing)...
// //
//--------------------------------------------------------------------- //---------------------------------------------------------------------
// Flat diff... // Flat diff...
@ -153,8 +152,6 @@ module.DIFF_OBJECT = AND(
AT('no_length', OR(BOOL, NULL)), AT('no_length', OR(BOOL, NULL)),
AT('cmp', OR(FUNCTION, NULL)) )), AT('cmp', OR(FUNCTION, NULL)) )),
AT('placeholders', AND( AT('placeholders', AND(
// XXX would be nice to store these and to use them to test
// deeper stuff (i.e. VALUE)...
AT('NONE', AT('NONE',
VAR('NONE', ANY)), VAR('NONE', ANY)),
AT('EMPTY', AT('EMPTY',