On Wed, Dec 4, 2013 at 8:54 AM, Mark Miller <erig...@gmail.com> wrote: > > > Given a synchronous join: > > if (join(master, slave)) { > ... use master for mastery stuff, use slave for slavy stuff ... > } else { > ... do the more expensive thing ... > } >
The sync case should be if (doesJoin(master, slave)) { ... use master for mastery stuff, use slave for slavy stuff ... } else { ... do the more expensive thing ... } where doesJoin is defined as function doesJoin(x,y) { try { join(x,y); return true; } catch(_) { return false; } } IIUC, doesJoin has the properties of the equivalence relation you seek. FWIW, this demonstrates that doesJoin is easily built from a hypothetical sync join operation. > > Given the actual async join: > > Q(join(master, slave)).then(() => { > ... use master for mastery stuff, use slave for slavy stuff ... > }, () => { > ... do the more expensive thing ... > }); > > We're here using join only to test whether it succeeds, not to actually > use its result. Admittedly this is kludgy, but IMO no more kludgy than the > problem statement demands. This would certainly not be the typical case for > using join. > > >> >> -- Cheers, --MarkM _______________________________________________ dev-tech-js-engine-internals mailing list dev-tech-js-engine-internals@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals